DropDownListBox and Item Value

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

Guest

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

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top