Currently I have a drop downlist as follows:
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="SelectionHasChanged"
DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="ID"
Width="214px">
/asp:DropDownList>
asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:MyDBConnectionString1 %>"
SelectCommand="SELECT [ID], Name], [Name] FROM [Names]">
/asp:SqlDataSource>
There are two things I'm trying to get the list to do when selection is either updated or deleted:
1)Remove deleted contents from DropDownList
2)The first entry in the database is found in the field when the page is loaded, I would like it to either be blank or say "Select"
Currently I need to refress the page to refresh the dropdownlist of deleted items.
I have tried adding DropDownList1.DataBind();
in various methods (page_load, update, delete) and DropDownList1.DataSource = SqlDataSource1;
(but I get a message to delete an object of (SqlDataSource1?)
I have added a tag/controll called EnableViewState="false"
, this refreshs the dropdownlist when I select another item, but when I delete an item I need the list to refresh right away.