THIS IS HOW DROPDOWNLIST1 IS SET UP. THERE ARE 2 LISTITEMS
THAT ARE PUT IN THAT ARE NOT FROM SQLDATASOURCE1, "" AT THE TOP AND "aa" JUST BELOW THAT.
<aspropDownList ID="DropDownList1" runat="server"
DataSourceID="ds1" DataTextField="code"
DataValueField="code" AppendDataBoundItems=true>
<asp:listitem value=""></asp:listitem>
<asp:listitem value="aa"></asp:listitem>
</aspropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ %>"
SelectCommand="SELECT *
FROM [Codes]
WHERE ([fldname]=@fldname)">
<SelectParameters>
<asparameter
DefaultValue="CUSTOMER" Name="Fldname" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:Label ID="Label2" runat="server" Text="Label" </asp:Label>
HERE IS PART OF THE CODE BEHIND. WHEN I TRY TO DISPLAY THE ITEM WITH THE VALUE READER1("CUSTOMER") WHICH IS DOWN IN THE LIST, DROPDOWNLIST1 JUST STAYS AT THE TOP,AT "". READER1("CUSTOMER") APPEARS CORRECT IN LABEL2.
HOW DO I GET IT TO WORK FOR READER1("CUSTOMER")?
If reader1.Read() Then
Label2.Text = "*" & reader1("customer") & "*"
TextBox1.Text = reader1("cno")
TextBox2.Text = reader1("service")
'DropDownList1.SelectedIndex = _
' DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue(reader1("customer")))
Else
Response.Write("nothing")
End If
THAT ARE PUT IN THAT ARE NOT FROM SQLDATASOURCE1, "" AT THE TOP AND "aa" JUST BELOW THAT.
<aspropDownList ID="DropDownList1" runat="server"
DataSourceID="ds1" DataTextField="code"
DataValueField="code" AppendDataBoundItems=true>
<asp:listitem value=""></asp:listitem>
<asp:listitem value="aa"></asp:listitem>
</aspropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ %>"
SelectCommand="SELECT *
FROM [Codes]
WHERE ([fldname]=@fldname)">
<SelectParameters>
<asparameter
DefaultValue="CUSTOMER" Name="Fldname" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:Label ID="Label2" runat="server" Text="Label" </asp:Label>
HERE IS PART OF THE CODE BEHIND. WHEN I TRY TO DISPLAY THE ITEM WITH THE VALUE READER1("CUSTOMER") WHICH IS DOWN IN THE LIST, DROPDOWNLIST1 JUST STAYS AT THE TOP,AT "". READER1("CUSTOMER") APPEARS CORRECT IN LABEL2.
HOW DO I GET IT TO WORK FOR READER1("CUSTOMER")?
If reader1.Read() Then
Label2.Text = "*" & reader1("customer") & "*"
TextBox1.Text = reader1("cno")
TextBox2.Text = reader1("service")
'DropDownList1.SelectedIndex = _
' DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue(reader1("customer")))
Else
Response.Write("nothing")
End If