This doesnt 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? Doesnt 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
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