jhilb Posted April 25, 2002 Posted April 25, 2002 This doesn't seem to work for me. The binding works, but the clearing of the selected item does not. After binding, I want to set the selectedindex to -1 which should no "no selection" right? Doesn't work. Always selects the first item. ' Clear and bind the events dropdown ddEvents.DataSource = Nothing ddEvents.Items.Clear() ddEvents.DataSource = oDB.GetDataView("SELECT * FROM tbEvent where evtcustomerid = '" + CompanyId + "' and evtIsDeleted = 0") ddEvents.DataTextField = "evtName" ddEvents.DataValueField = "evtEventId" ddEvents.DataBind() ddEvents.SelectedIndex = -1 Quote
Guest MichaelK Posted May 20, 2002 Posted May 20, 2002 I've found that the -1 SelectedIndex only works for a DropDownStyle of 'DropDown', not 'DropDownList'. You didn't mention specifically what your DropDownStyle is, but this is a simple check... MichaelK Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.