DropDownListBox and Item Value

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

Guest

I use the following piece of code to programatically insert an item into a
dropdownlistbox:

myDropdownListBox.items.insert(0, myDisplayedText)

This works but the value of the item is then the same as myDisplayedText.

My question: I want the value to be something different. How I can I
programmatically code the value of the item to be something different that
the displayed text?
 
let me know if this helps
ListItem li= new ListItem();
li.Text ="a";
li.Value ="b";
DropDownList1.Items.Insert(0,li);
 

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