Stupid format question

Discussion in 'ASP .Net' started by =?Utf-8?B?R2hpc3Rvcw==?=, Aug 27, 2007.

  1. I know, this is a very simple question but...

    I want to bound an ObjectDataSource with
    a DropDownList.

    And I want to do it like that :

    Residential
    Condominium
    Duplex
    Triplex
    Land
    Commercial Lands...

    These come from a class with properties and I just want to insert blank
    space or better, tab character in it. I tried it but when it come to the
    browser, all my spaces are trim.

    Why ?
     
    =?Utf-8?B?R2hpc3Rvcw==?=, Aug 27, 2007
    #1
    1. Advertising

  2. =?Utf-8?B?R2hpc3Rvcw==?=

    bruce barker Guest

    if you use a real select, then you can use optgroup

    <select>
    <optgroup label="Residential">
    <option>Condominium</option>
    <option>Duplex</option>
    <option>Triplex</option>
    </optgroup>
    <optgroup label="Land">
    <option>Commercial</option>
    </optgroup>
    </select>


    -- bruce (sqlwork.com)


    Ghistos wrote:
    > I know, this is a very simple question but...
    >
    > I want to bound an ObjectDataSource with
    > a DropDownList.
    >
    > And I want to do it like that :
    >
    > Residential
    > Condominium
    > Duplex
    > Triplex
    > Land
    > Commercial Lands...
    >
    > These come from a class with properties and I just want to insert blank
    > space or better, tab character in it. I tried it but when it come to the
    > browser, all my spaces are trim.
    >
    > Why ?
    >
    >
    >
    >
     
    bruce barker, Aug 27, 2007
    #2
    1. Advertising

  3. On Aug 27, 9:20 pm, Ghistos <> wrote:
    > I know, this is a very simple question but...
    >
    > I want to bound an ObjectDataSource with
    > a DropDownList.
    >
    > And I want to do it like that :
    >
    > Residential
    > Condominium
    > Duplex
    > Triplex
    > Land
    > Commercial Lands...
    >
    > These come from a class with properties and I just want to insert blank
    > space or better, tab character in it. I tried it but when it come to the
    > browser, all my spaces are trim.
    >
    > Why ?


    use a non-breaking space character &nbsp;
     
    Alexey Smirnov, Aug 27, 2007
    #3
  4. =?Utf-8?B?R2hpc3Rvcw==?=, Aug 27, 2007
    #4
  5. =?Utf-8?B?R2hpc3Rvcw==?=

    Lit Guest

    Ghistos,

    have you been able to incorporate all the bug fixes for that Control from
    the link you provided?

    If you know a download that has all the fixed I appreciate it if you can
    share it with us.

    using the control as is I am getting

    Error 1 The name 'ddlItems' does not exist in the current context
    DropDownListOptionGroup.aspx.cs

    Thank you,

    Lit


    "Ghistos" <> wrote in message
    news:...
    > Tks Bruce
    >
    > I find on the net
    > http://www.codeproject.com/aspnet/DropDownListOptionGroup.asp
    >
    > A dotNet dropdownList with the OptionGroup and Item based on what you say
    > to
    > me.
    >
    > It works very well...
    >
    > I tried the &nbsp in my class but this method not work or maybe it's me.
    >
    > Tks again
    >
     
    Lit, Aug 27, 2007
    #5
  6. I'm not sure to understand your problem.

    I create a user control with the code. There's no bugs in the adapter. For
    the code in the ascx.cs this is what I have done with comments from the
    article...

    Where CategorieBatimentList is a generic list of CategorieBatimentInfo.

    I loop in my collection and then add the objects in my dropdownlist.

    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
    {

    CategorieBatimentList catBats =
    CategoriesBatiment.GetCategoriesBatiment();
    foreach (CategorieBatimentInfo catbat in catBats)
    {
    ListItem currentItem = new
    ListItem(catbat.DescriptionFrancais, catbat.CodeCategorie);
    currentItem.Attributes["OptionGroup"] =
    catbat.DescriptionGroupeFrancais;
    ddlCatBatiment.Items.Add(currentItem);
    }
    }
    }
     
    =?Utf-8?B?R2hpc3Rvcw==?=, Aug 28, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael W Cocke

    Stupid RE question

    Michael W Cocke, Dec 27, 2004, in forum: Perl
    Replies:
    2
    Views:
    430
    Michael W Cocke
    Dec 28, 2004
  2. Steve

    Is this a stupid question?

    Steve, Jul 17, 2003, in forum: ASP .Net
    Replies:
    6
    Views:
    354
    Mario Vargas
    Jul 17, 2003
  3. Smashingraph
    Replies:
    1
    Views:
    404
    VisionSet
    Sep 2, 2003
  4. Brandon McCombs
    Replies:
    4
    Views:
    519
    Richard Wheeldon
    Aug 28, 2006
  5. rincewind

    stupid, STUPID question!

    rincewind, Apr 19, 2009, in forum: HTML
    Replies:
    25
    Views:
    1,026
Loading...

Share This Page