473,406 Members | 2,273 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,406 software developers and data experts.

DropDownList Control

I have two DropDownList controls in a web form and I need to test which
control has changed without wrapping it in a SelectedIndexChange Event. How
do I go about this issue? I have tried the following which works sort of but
the first time I change the selection in one of the DropDownList controls it
returns a SelectedValue of null.

public string ctrlSelection
{
get
{
if(SubList.SelectedValue == null || SubList.SelectedValue == "<-Sub
Menu->")
{

return MainMenuLST.SelectedValue;
}
else
{
return SubList.SelectedValue;
}
}
}
Nov 19 '05 #1
1 1341
I am Sam wrote:
I have two DropDownList controls in a web form and I need to test which
control has changed without wrapping it in a SelectedIndexChange Event. How
do I go about this issue? I have tried the following which works sort of but
the first time I change the selection in one of the DropDownList controls it
returns a SelectedValue of null.

public string ctrlSelection
{
get
{
if(SubList.SelectedValue == null || SubList.SelectedValue == "<-Sub
Menu->")
{

return MainMenuLST.SelectedValue;
}
else
{
return SubList.SelectedValue;
}
}
}


So they change a drop down, they click submit, and you want to see which
one has changed? What if both were changed?

DO you have an option in each DDL that states what type of DDL it is ie
your: "<-Sub Menu->".

If both have something like that,

if(SubList.SelectedText == "<-SubMenu->" || MainMenuLST.SelectedText ==
"<-MainMenu->")
{
//Nothing Changed
}
else
{
if(SubList.SelectedText != "<-SubMenu->" &&
MainMenuLST.SelectedText == "<-Mainmenu->")
{
//Sublist changed
}
else
{
if(SubList.SelectedText == "<-SubMenu->" &&
MainMenuLST.SelectedText != "<-Mainmenu->")
{
//MainMenuChanged
}
else
{
if(SubList.SelectedText != "<-SubMenu->" &&
MainMenuLST.SelectedText != "<-Mainmenu->")
{
//They Bothchanged
}
)
)
)
It's long, but simple.
Nov 19 '05 #2

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

Similar topics

4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
2
by: Dominic | last post by:
Hi guys, I'm not sure if this question belongs to FAQ, but I couldn't find a concrete answer. I created a Datagrid control using ItemTemplate, but it's NOT a in-place editing datagrid. One of...
18
by: Julia Hu | last post by:
Hi, I have a datagrid, and in different rows I need to programmatically bind different type of controls and load data into these controls. For example,in the first row I need to bind data into a...
10
by: Sacha Korell | last post by:
I'm trying to load a drop-down list with all DropDownList control names from another page. How would I be able to find those DropDownList controls? The FindControl method will only find a...
1
by: | last post by:
This is a crosspost from a less-frequented (but more focused) asp.net group; I didn't receive an answer that worked. I'd like to get this form functional. Could someone help on what's probably a...
2
by: glenn | last post by:
Hi folks, I am trying to determine which item in a DropDownList Web control has been selected. I have posted an OnSelectedIndexChanged subroutine in my code with a reference to the subroutine...
15
by: glenn | last post by:
Hi folks, I have a DropDownList in a DataGrid that is populated from records in a database. I want to add a value that might be a string such as "Select a Company" for the first item since an...
18
by: Redhairs | last post by:
Is it possible to get DropDownList.SelectedValue in Page_PreInit() event during the postback?
1
by: MaryamSh | last post by:
Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button...
0
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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
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...
0
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...
0
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,...
0
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...

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.