472,325 Members | 1,022 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,325 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 3638

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...
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. ...
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;...
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...
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...
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...
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 ,...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.