Wednesday, January 26, 2011

DropDownList - Set selected value


The following code snippent shows how to set the selected item of a
DropdownList


 


DropDownList1.ClearSelection();
ListItem li = DropDownList1.Items.FindByValue("20");
DropDownList1.Items.FindByText(li.Text).Selected = true;


I have seen many beginners are struggling to set the selected value  dynamically,
Hope this is very helpful.

0 comments:

My Achievements

Member of

Blog Archive

Followers