A
andy
Hi,
I have a form uses several dropdownlists to narrow a set of criteria.
( This is in turn used to control what is shown on a gridview. )
With each, the user selects an entry and then the next dropdownlist
uses that control's selected value to drive what it shows.
They're all set to autopostback.
Everything works fine except where one of the levels only has one
entry.
This seems to mess up the next level down and you see the wrong
results.
If you fiddle around and select another branch of the tree has more
than one entry in a list then go back it finds the data.
So all the control sources etc are OK.
Any ideas on a work round?
Code snippet:
<fieldset style="width:200px;padding:3px">
<legend>Business Level</legend>
<h2>Conpany</h2>
<aspropDownList ID="ddlCompanies" width="99%" runat="server"
DataSourceID="sdsCompanies" DataTextField="Company"
DataValueField="Company_Id" AutoPostBack="True"
ToolTip="Company">
</aspropDownList>
<h2>Business Stream</h2>
<aspropDownList ID="ddlBusiness_Streams" width="99%"
runat="server" DataSourceID="sdsBusiness_Streams"
DataTextField="Business_Stream"
DataValueField="Business_Stream_Id" AutoPostBack="True"
ToolTip="Business Stream">
</aspropDownList>
<h2>Operating Group</h2>
<aspropDownList ID="ddlOperating_Groups" width="99%"
runat="server" AutoPostBack="True" DataSourceID="sdsOperating_Groups"
DataTextField="Operating_Group"
DataValueField="Operating_Group_Id" ToolTip="Operating Group">
</aspropDownList>
<h2>Business Unit</h2>
<aspropDownList ID="ddlBusiness_Units" width="99%"
runat="server" AutoPostBack="True" DataSourceID="sdsBusiness_Unit"
DataTextField="Business_Unit"
DataValueField="Business_Unit_Id" ToolTip="Business Unit" >
</aspropDownList>
<h2>Division</h2>
<aspropDownList ID="ddlDivisions" width="99%"
runat="server" AutoPostBack="True" DataSourceID="sdsDivisions"
DataTextField="Division" DataValueField="Div_No"
ToolTip="Division">
</aspropDownList>
</fieldset>
<asp:SqlDataSource ID="sdsCompanies" runat="server"
ConnectionString="<%$ ConnectionStrings:SQLConnectionString %>"
SelectCommand="SELECT [Company_Id], [Company] FROM
[Companies] ORDER BY [Company]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="sdsBusiness_Streams" runat="server"
ConnectionString="<%$ ConnectionStrings:SQLConnectionString %>"
SelectCommand="SELECT [Business_Stream_Id],
[Business_Stream] FROM [Business_Streams] WHERE ([Company_Id] =
@Company_Id) ORDER BY [Business_Stream]">
<SelectParameters>
<asp:ControlParameter ControlID="ddlCompanies"
DefaultValue="0" Name="Company_Id"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="sdsOperating_Groups" runat="server"
ConnectionString="<%$ ConnectionStrings:SQLConnectionString %>"
SelectCommand="SELECT [Operating_Group_Id],
[Operating_Group] FROM [Operating_Groups] WHERE ([Business_Stream_Id]
= @Business_Stream_Id)">
<SelectParameters>
<asp:ControlParameter ControlID="ddlBusiness_Streams"
DefaultValue="0" Name="Business_Stream_Id"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="sdsBusiness_Unit" runat="server"
ConnectionString="<%$ ConnectionStrings:SQLConnectionString %>"
SelectCommand="SELECT [Business_Unit_Id], [Business_Unit]
FROM [Business_Units] WHERE ([Operating_Group_Id] =
@Operating_Group_Id)">
<SelectParameters>
<asp:ControlParameter ControlID="ddlOperating_Groups"
DefaultValue="0" Name="Operating_Group_Id"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="sdsDivisions" runat="server"
ConnectionString="<%$ ConnectionStrings:SQLConnectionString %>"
SelectCommand="SELECT [Div_No], [Division] FROM
[Divisions] WHERE ([Business_Unit_Id] = @Business_Unit_Id)">
<SelectParameters>
<asp:ControlParameter ControlID="ddlBusiness_Units"
DefaultValue="0" Name="Business_Unit_Id"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
I have a form uses several dropdownlists to narrow a set of criteria.
( This is in turn used to control what is shown on a gridview. )
With each, the user selects an entry and then the next dropdownlist
uses that control's selected value to drive what it shows.
They're all set to autopostback.
Everything works fine except where one of the levels only has one
entry.
This seems to mess up the next level down and you see the wrong
results.
If you fiddle around and select another branch of the tree has more
than one entry in a list then go back it finds the data.
So all the control sources etc are OK.
Any ideas on a work round?
Code snippet:
<fieldset style="width:200px;padding:3px">
<legend>Business Level</legend>
<h2>Conpany</h2>
<aspropDownList ID="ddlCompanies" width="99%" runat="server"
DataSourceID="sdsCompanies" DataTextField="Company"
DataValueField="Company_Id" AutoPostBack="True"
ToolTip="Company">
</aspropDownList>
<h2>Business Stream</h2>
<aspropDownList ID="ddlBusiness_Streams" width="99%"
runat="server" DataSourceID="sdsBusiness_Streams"
DataTextField="Business_Stream"
DataValueField="Business_Stream_Id" AutoPostBack="True"
ToolTip="Business Stream">
</aspropDownList>
<h2>Operating Group</h2>
<aspropDownList ID="ddlOperating_Groups" width="99%"
runat="server" AutoPostBack="True" DataSourceID="sdsOperating_Groups"
DataTextField="Operating_Group"
DataValueField="Operating_Group_Id" ToolTip="Operating Group">
</aspropDownList>
<h2>Business Unit</h2>
<aspropDownList ID="ddlBusiness_Units" width="99%"
runat="server" AutoPostBack="True" DataSourceID="sdsBusiness_Unit"
DataTextField="Business_Unit"
DataValueField="Business_Unit_Id" ToolTip="Business Unit" >
</aspropDownList>
<h2>Division</h2>
<aspropDownList ID="ddlDivisions" width="99%"
runat="server" AutoPostBack="True" DataSourceID="sdsDivisions"
DataTextField="Division" DataValueField="Div_No"
ToolTip="Division">
</aspropDownList>
</fieldset>
<asp:SqlDataSource ID="sdsCompanies" runat="server"
ConnectionString="<%$ ConnectionStrings:SQLConnectionString %>"
SelectCommand="SELECT [Company_Id], [Company] FROM
[Companies] ORDER BY [Company]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="sdsBusiness_Streams" runat="server"
ConnectionString="<%$ ConnectionStrings:SQLConnectionString %>"
SelectCommand="SELECT [Business_Stream_Id],
[Business_Stream] FROM [Business_Streams] WHERE ([Company_Id] =
@Company_Id) ORDER BY [Business_Stream]">
<SelectParameters>
<asp:ControlParameter ControlID="ddlCompanies"
DefaultValue="0" Name="Company_Id"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="sdsOperating_Groups" runat="server"
ConnectionString="<%$ ConnectionStrings:SQLConnectionString %>"
SelectCommand="SELECT [Operating_Group_Id],
[Operating_Group] FROM [Operating_Groups] WHERE ([Business_Stream_Id]
= @Business_Stream_Id)">
<SelectParameters>
<asp:ControlParameter ControlID="ddlBusiness_Streams"
DefaultValue="0" Name="Business_Stream_Id"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="sdsBusiness_Unit" runat="server"
ConnectionString="<%$ ConnectionStrings:SQLConnectionString %>"
SelectCommand="SELECT [Business_Unit_Id], [Business_Unit]
FROM [Business_Units] WHERE ([Operating_Group_Id] =
@Operating_Group_Id)">
<SelectParameters>
<asp:ControlParameter ControlID="ddlOperating_Groups"
DefaultValue="0" Name="Operating_Group_Id"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="sdsDivisions" runat="server"
ConnectionString="<%$ ConnectionStrings:SQLConnectionString %>"
SelectCommand="SELECT [Div_No], [Division] FROM
[Divisions] WHERE ([Business_Unit_Id] = @Business_Unit_Id)">
<SelectParameters>
<asp:ControlParameter ControlID="ddlBusiness_Units"
DefaultValue="0" Name="Business_Unit_Id"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>