Stupid format question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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 ?
 
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)
 
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;
 
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
 
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);
}
}
}
 
Back
Top