Expand|Select|Wrap|Line Numbers
- <asp:DropDownList ID="DropDownList5" runat="server" AppendDataBoundItems="True"
- DataSourceID="SqlDataSource6" DataTextField="StaffName"
- DataValueField="StaffName" SelectedValue='<%# Bind("LetterName") %>'>
- <asp:ListItem Value=""> </asp:ListItem>
- </asp:DropDownList>
Expand|Select|Wrap|Line Numbers
- Protected Sub Formview1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView1.PreRender
- Dim dropdown As DropDownList
- Dim listvalue As TextBox
- dropdown = FormView1.FindControl("dropdownlist5")
- listvalue = FormView1.FindControl("textbox1")
- dropdown.Items.Add(New ListItem(listvalue.Text, listvalue.Text))
- End Sub
Parameter name: value "
This is the bit I dont understand because the selected value is in the list of items as it is the value I just added in from the textbox, is it checking for the selected value before adding the new list item? If so how do I add the item before the selected value or not set a selected value and have it set selected value in the VB code after adding items to the dropdownlist?