I've encountered a problem that seems to have me stuck. I have a DropDownList3 that gets filtered by the values of two other dropdownlists ( 1 and 2) on the form. DropDownlist3 should show:
--- Select Item ---
AAAAAAAAAAAAAA
BBBBBBBBBBBBBBBB
But instead it shows:
--- Select Item ---
AAAAAAAAAAAAAA
BBBBBBBBBBBBBBBB
AAAAAAAAAAAAAA
BBBBBBBBBBBBBBBB
It seems perfectly functional otherwise. Now if I take away the AppendDataBoundItems="True", then it shows only two items, but it does not show the --- Select Item --- at the top, which prevents the AAAAAAAAAA SelectedIndexChanged event from firing when you click the top item. The same is true if I remove the "<asp:ListItem Value="">--- Select Item ---</asp:ListItem>".
Here is the code:
Code:
<asp:Label id="ItemId" AssociatedControlId="DropDownList3" Text="Item: " runat="server" />
<asp:DropDownList ID="DropDownList3" runat="server"
DataSourceID="SqlDataSource3" DataTextField="ITEM_DESCR"
DataValueField="ID_KEY" AutoPostBack="True"
onselectedindexchanged="DropDownList3_SelectedIndexChanged"
AppendDataBoundItems="True" CssClass="RightMargin">
<asp:ListItem Value="">--- Select Item ---</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:BCConnectionString %>"
SelectCommand="SELECT [ITEM_DESCR], [ITEM_ID], [HEADING], [SUB_HEADING], [ID_KEY] FROM [QPURCH] WHERE (([EMP_NAME] =
@userName) AND ([FORM_NAME] = @FORM_NAME) AND ([DEPT] = @DEPT)) ORDER BY [HEADING], [SUB_HEADING], [ITEM_DESCR]"
onselecting="SqlDataSource3_Selecting">
<SelectParameters>
<asp:Parameter Name="UserName" Type="String" />
<asp:ControlParameter ControlID="DropDownList2" Name="FORM_NAME"
PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownList1" Name="DEPT"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>