473,729 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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: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>

Mar 28 '07 #1
0 3736

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

Similar topics

2
3422
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 being dependent on the value of the first. My DropDownList control definitions look like this: <asp:dropdownlist id="ddlLocCty" runat="server" CssClass="SmlBox" AutoPostback="True" CausesValidation="False"></asp:dropdownlist> <asp:dropdownlist...
7
6179
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
4393
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 my controls are created in CreateChildControls() for my custom control. Here's a snippet of code: DropDownList dd = new DropDownList(); dd.ID = "DropDown1"; if( !Page.IsPostBack )
11
5811
by: Santosh | last post by:
Dear all , i am writting following code. if(Page.IsPostBack==false) { try { BindSectionDropDownlist();
2
9958
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
10587
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 second of which resides within an UpdatePanel control which responds to a change in the first DropDownList. I also have a hidden button nested inside the UpdatePanel to force a postback via JS. The user uses these two DropDownList controls to create...
3
3831
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 DropDownList1 using the ScriptManager SetFocus method. Use the Visual Studio debugger. Set a breakpoint on in the (!IsPostBack) part of the PageLoad method. Start the web application and continue after the breakpoint has been reached.
0
1939
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 almost everything. but it whas made in Visual Studio 7 and i converted it to 2005. in version 7 it works almost perfect but in 2005 i am having some errors. becase all the code i am using is very long i am trying to post the nesecery code only if...
6
4277
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 boxes are generating a postback.here is a code . protected void Page_Load(object sender, EventArgs e) { int selected_question = (int)Session; if (!Page.IsPostBack) { display_blueprint(); string...
0
8921
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8763
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9284
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9202
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9148
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8151
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2683
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.