i have a question for you .netters out there. i am using a dropdownlist on a webform and loading the values from a database. works fine.
what i want to do is jump to an item in the list by using the "findbyvalue" function. e.g:
this failed. i was told something along the lines of "an item is already selected so u cant do that"Code:ddlCountys.Items.FindByValue(rs("CountyID").ToString()).Selected = True
i resolved this by using "ddl.selecteditem.selected = false", the result being:
there is something about having to do that which irritates me, i dont want two lines of codeCode:ddlCountys.SelectedItem.Selected = False ddlCountys.Items.FindByValue(rs("CountyID").ToString()).Selected = True![]()
whats a better way please?




Reply With Quote