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:20 0px;padding:3px ">
<legend>Busines s Level</legend>
<h2>Conpany</h2>
<asp:DropDownLi st ID="ddlCompanie s" width="99%" runat="server"
DataSourceID="s dsCompanies" DataTextField=" Company"
DataValueField= "Company_Id " AutoPostBack="T rue"
ToolTip="Compan y">
</asp:DropDownLis t>
<h2>Business Stream</h2>
<asp:DropDownLi st ID="ddlBusiness _Streams" width="99%"
runat="server" DataSourceID="s dsBusiness_Stre ams"
DataTextField=" Business_Stream "
DataValueField= "Business_Strea m_Id" AutoPostBack="T rue"
ToolTip="Busine ss Stream">
</asp:DropDownLis t>
<h2>Operating Group</h2>
<asp:DropDownLi st ID="ddlOperatin g_Groups" width="99%"
runat="server" AutoPostBack="T rue" DataSourceID="s dsOperating_Gro ups"
DataTextField=" Operating_Group "
DataValueField= "Operating_Grou p_Id" ToolTip="Operat ing Group">
</asp:DropDownLis t>
<h2>Business Unit</h2>
<asp:DropDownLi st ID="ddlBusiness _Units" width="99%"
runat="server" AutoPostBack="T rue" DataSourceID="s dsBusiness_Unit "
DataTextField=" Business_Unit"
DataValueField= "Business_Unit_ Id" ToolTip="Busine ss Unit" >
</asp:DropDownLis t>
<h2>Division</h2>
<asp:DropDownLi st ID="ddlDivision s" width="99%"
runat="server" AutoPostBack="T rue" DataSourceID="s dsDivisions"
DataTextField=" Division" DataValueField= "Div_No"
ToolTip="Divisi on">
</asp:DropDownLis t>
</fieldset>
<asp:SqlDataSou rce ID="sdsCompanie s" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:SQLConnectio nString %>"
SelectCommand=" SELECT [Company_Id], [Company] FROM
[Companies] ORDER BY [Company]">
</asp:SqlDataSour ce>
<asp:SqlDataSou rce ID="sdsBusiness _Streams" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:SQLConnectio nString %>"
SelectCommand=" SELECT [Business_Stream _Id],
[Business_Stream] FROM [Business_Stream s] WHERE ([Company_Id] =
@Company_Id) ORDER BY [Business_Stream]">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="ddlC ompanies"
DefaultValue="0 " Name="Company_I d"
PropertyName="S electedValue" Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
<asp:SqlDataSou rce ID="sdsOperatin g_Groups" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:SQLConnectio nString %>"
SelectCommand=" SELECT [Operating_Group _Id],
[Operating_Group] FROM [Operating_Group s] WHERE ([Business_Stream _Id]
= @Business_Strea m_Id)">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="ddlB usiness_Streams "
DefaultValue="0 " Name="Business_ Stream_Id"
PropertyName="S electedValue" Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
<asp:SqlDataSou rce ID="sdsBusiness _Unit" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:SQLConnectio nString %>"
SelectCommand=" SELECT [Business_Unit_I d], [Business_Unit]
FROM [Business_Units] WHERE ([Operating_Group _Id] =
@Operating_Grou p_Id)">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="ddlO perating_Groups "
DefaultValue="0 " Name="Operating _Group_Id"
PropertyName="S electedValue" Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
<asp:SqlDataSou rce ID="sdsDivision s" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:SQLConnectio nString %>"
SelectCommand=" SELECT [Div_No], [Division] FROM
[Divisions] WHERE ([Business_Unit_I d] = @Business_Unit_ Id)">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="ddlB usiness_Units"
DefaultValue="0 " Name="Business_ Unit_Id"
PropertyName="S electedValue" Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>