473,395 Members | 1,383 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 3714

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Brennon Arnold | last post by:
I have a problem that I figured would be relatively common, but have been unable to find any information on it as of yet. I have a page that contains two DropDownList controls, with the second...
7
by: Daniel | last post by:
Is there any other way can override this event, like javascript onchange added to the attribute of this dropdownlist? Thanks
5
by: bryanp10 | last post by:
I have a page that is almost entirely dynamically created. Textboxes and checkbox are working fine, firing events, and persistent their state. DropDownList is giving me a major headache. All...
11
by: Santosh | last post by:
Dear all , i am writting following code. if(Page.IsPostBack==false) { try { BindSectionDropDownlist();
2
by: sree reddy | last post by:
..cs using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls;
3
by: Lohboy | last post by:
Using ASP.NET and IE7. (Sorry if I am posting in the wrong forum but my problem seemed to be more related to the JavaScript side than the ASP.NET side.) I have two DropDownList controls the...
3
by: =?Utf-8?B?Y21lZWsxXzE5OTk=?= | last post by:
Hello, On a webpage, create an UpdatePanel with two DropDownLists. Set AutoPostBack of DropDownList1 to true. In the SelectedIndexChanged method, refill DropDownList2 and set the focus to...
0
by: asmx126453 | last post by:
Hey mensen I am having some big troubles here i tryd solving it myself with internet for 2 days but i kind fix it. Its about this i have a DotNet project that alrydi is online and working for...
6
by: shashi shekhar singh | last post by:
Respected Sir, I have to create multiple dynamic dropdownlist boxes and add items dynamically in <asp:table> server control but problem occurs , i.e. except of fist dropdown list no dropdownlist...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.