Stupid format question

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 ?
 
B

bruce barker

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)
 
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 ?

use a non-breaking space character &nbsp;
 
L

Lit

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
 
G

Guest

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);
}
}
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top