Thursday, July 26, 2012

“DropDownList.SelectedIndex = -1” problem

Please try below syntax: 


DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue("Select")) 
or 
DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByText("SelectText")) 
or 
 DropDownList1.Items.FindByText("Select").selected =true


you can refer solution at :
http://stackoverflow.com/questions/81214/dropdownlist-selectedindex-1-problem/11666108#11666108

No comments:

Post a Comment