Dropdownlist headings

  • Thread starter Thread starter jack-e
  • Start date Start date
J

jack-e

Hi,

Senario: i have a dropdownlist which is bound to a lookup table.

question: how do i insert headings into the dropdownlist which cannot
be selected, without altering the selected values of the other bound
items?

Thanks.

Jack
 
Hi

Just use the following code:

ListItem item = new ListItem("Header", "somevalue");
ddlCategory.Items.Insert(0, item);
// OR //
ddlCategory.Items.Insert(0, "Header");
 
jack-e said:
how do i disable the item so the user can't select it?

ListItem li = new ListItem("Text", "Value");
li.Enabled = false;

Kev
 

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

Back
Top