469,645 Members | 1,143 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

dropdownlist autopostback problem

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>
<asp:DropDownList ID="ddlCompanies" width="99%" runat="server"
DataSourceID="sdsCompanies" DataTextField="Company"
DataValueField="Company_Id" AutoPostBack="True"
ToolTip="Company">
</asp:DropDownList>
<h2>Business Stream</h2>
<asp:DropDownList ID="ddlBusiness_Streams" width="99%"
runat="server" DataSourceID="sdsBusiness_Streams"
DataTextField="Business_Stream"
DataValueField="Business_Stream_Id" AutoPostBack="True"
ToolTip="Business Stream">
</asp:DropDownList>
<h2>Operating Group</h2>
<asp:DropDownList ID="ddlOperating_Groups" width="99%"
runat="server" AutoPostBack="True" DataSourceID="sdsOperating_Groups"
DataTextField="Operating_Group"
DataValueField="Operating_Group_Id" ToolTip="Operating Group">
</asp:DropDownList>
<h2>Business Unit</h2>
<asp:DropDownList ID="ddlBusiness_Units" width="99%"
runat="server" AutoPostBack="True" DataSourceID="sdsBusiness_Unit"
DataTextField="Business_Unit"
DataValueField="Business_Unit_Id" ToolTip="Business Unit" >
</asp:DropDownList>
<h2>Division</h2>
<asp:DropDownList ID="ddlDivisions" width="99%"
runat="server" AutoPostBack="True" DataSourceID="sdsDivisions"
DataTextField="Division" DataValueField="Div_No"
ToolTip="Division">
</asp:DropDownList>
</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>

Mar 28 '07 #1
0 3543

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Brennon Arnold | last post: by
11 posts views Thread by Santosh | last post: by
3 posts views Thread by =?Utf-8?B?Y21lZWsxXzE5OTk=?= | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.