lstSchool.SelectedIndex = -1
lstSchool.Items.FindByValue(dtrNonNihFunding.Item(10)).Selected = True
If I do not reset the index I'm getting an error that you cannot select two lines. I'm reading using a dataReader.
Thanks.You probably have populated your ddl in the Page_load, from a db, or whatever - -
Put the loading of the ddl inside an if/then/PageisPostback block:
If not PageIsPostBack then
' populate your ddl here.
end if
Ya I hate that too but it seems that when you set the selected index property it doesn't unselect the previous value first so you must do it manually or else you have the problem of having 2 items selected which is not possible.
Why not:
lstSchool.SelectedIndex = lstSchool.Items.FindByValue(dtrNonNihFunding.Item(10)).Index
?
0 comments:
Post a Comment