Sunday, March 18, 2012

FindByValue for DropDownList in asp.net

Cannot have multiple items selected in a DropDownList.
The solution is to remember to call ClearSelection() Method before calling FindByValue("strValue") or FindByText("strtext") Method. 


dropDownList1.ClearSelection();
dropDownList1.Items.FindByValue("strValue").Selected = true; 

No comments:

Post a Comment

Comments

Search

Custom Search
Protected by Copyscape Plagiarism Software