Having Problem With DropDownList

J

James

Hi,

I have a ListItemCollection which contains data like below:

System.Web.UI.WebControls.ListItemCollection licListItems = new
System.Web.UI.WebControls.ListItemCollection ();
licListItems.Add (new ListItem ("One", "1"));
licListItems.Add (new ListItem ("Two", "2"));
licListItems.Add (new ListItem ("Three", "3"));
return licListItems;


But when I bind this ListItemCollection into a DropDownList,
the DropDownList generated HTML code like below:
<select>
<option value="One">One
<option value="Two">Two
<option value="Three">Three
</select>

Instead of
<select>
<option value="1">One
<option value="2">Two
<option value="3">Three
</select>


Can anybody help?

Thanks & Regards,
James
 

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,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top