Databound DDL not keeping all list items
Posted on 2007-10-07
I have a ddl, which is not initially bound to a datasource with 4 listItems. User selects one list item, then clicks the save button, which inputs the selected item into database. When I recall the selected item back to the ddl on page load, I have the ddl databound, and it recalls the item that was selected just fine, but it does not show the other list items in the ddl. I need to have all the items still available, in case the user needs to change their selection.
Here is my code:
Dim Adapter As New SqlDataAdapter("SELECT * FROM Orders Where OrdersID = " & list1.SelectedItem.Value, "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Client.mdf;Integrated Security=True;User Instance=True")
Dim Dataset As New DataSet
Me.Representing.DataMember = "Orders"
Me.Representing.DataSource = Dataset
Me.Representing.DataTextField = "Representing"
Me.Representing.DataValueField = "OrdersID"
<asp:DropDownList ID="Representing" runat="server" Height="18px"