473,387 Members | 1,897 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,387 software developers and data experts.

One item dropdowns

Jon
I am using cascading dropdowns, where one dropdown determines the data in
the next, etc...

If a dropdown has only one item in it, the SelectedIndexChanged event is
never fired, even if you click on the dropdown and "reselect" the single
item. This also happens when there are multiple items in the DD with the
first item. You have to select another list item, then reselect the first
one to have the event fire. I have it set to AutoPostBack, but obviously it
is not in these situations. Is there a way to make the event happen in
these situations.

I tried the following (thinking it would force the user to select the item
and fire the event), but it still selected the single item.

ddTest.DataBind()
ddTest.SelectedIndex = -1

Thanks

--
********************************
Jon Rosenberg
Nov 18 '05 #1
3 1534
Try adding a "-- Select Item --" item to the top of the list. That way,
selecting even the only ONE (other) item in the dropdown causes a
selectedIndex changed event.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Jon" <ru******@msn.com> wrote in message
news:10*************@corp.supernews.com...
I am using cascading dropdowns, where one dropdown determines the data in
the next, etc...

If a dropdown has only one item in it, the SelectedIndexChanged event is
never fired, even if you click on the dropdown and "reselect" the single
item. This also happens when there are multiple items in the DD with the
first item. You have to select another list item, then reselect the first
one to have the event fire. I have it set to AutoPostBack, but obviously it is not in these situations. Is there a way to make the event happen in
these situations.

I tried the following (thinking it would force the user to select the item
and fire the event), but it still selected the single item.

ddTest.DataBind()
ddTest.SelectedIndex = -1

Thanks

--
********************************
Jon Rosenberg

Nov 18 '05 #2
Jon
Thanks. Not the solution I was hoping for, but it certainly works.
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Try adding a "-- Select Item --" item to the top of the list. That way,
selecting even the only ONE (other) item in the dropdown causes a
selectedIndex changed event.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Jon" <ru******@msn.com> wrote in message
news:10*************@corp.supernews.com...
I am using cascading dropdowns, where one dropdown determines the data in
the next, etc...

If a dropdown has only one item in it, the SelectedIndexChanged event is
never fired, even if you click on the dropdown and "reselect" the single
item. This also happens when there are multiple items in the DD with the
first item. You have to select another list item, then reselect the
first
one to have the event fire. I have it set to AutoPostBack, but obviously

it
is not in these situations. Is there a way to make the event happen in
these situations.

I tried the following (thinking it would force the user to select the
item
and fire the event), but it still selected the single item.

ddTest.DataBind()
ddTest.SelectedIndex = -1

Thanks

--
********************************
Jon Rosenberg


Nov 18 '05 #3
Just thinking about this. Forgive me if this is a silly idea, but here goes.
I get the impression that you don't want the "-- Select Item --" to show in
the dropdown list. I would suggest including it as suggested, but setting
the style atrribute to "visibility: hidden; height:0; width:0"

ME

"Jon" <ru******@msn.com> wrote in message
news:10*************@corp.supernews.com...
Thanks. Not the solution I was hoping for, but it certainly works.
"Kevin Spencer" <ks******@takempis.com> wrote:-
Try adding a "-- Select Item --" item to the top of the list. That way,
selecting even the only ONE (other) item in the dropdown causes a
selectedIndex changed event.
"Jon" <ru******@msn.com> wrote:-
I am using cascading dropdowns, where one dropdown determines the data in the next, etc...

If a dropdown has only one item in it, the SelectedIndexChanged event is never fired, even if you click on the dropdown and "reselect" the single item. This also happens when there are multiple items in the DD with the first item. You have to select another list item, then reselect the
first
one to have the event fire. I have it set to AutoPostBack, but
obviously it
is not in these situations. Is there a way to make the event happen in
these situations.

I tried the following (thinking it would force the user to select the
item
and fire the event), but it still selected the single item.

ddTest.DataBind()
ddTest.SelectedIndex = -1


--
Martin Eyles
ma**********@NOSPAM.bytronic.com
Nov 18 '05 #4

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

Similar topics

3
by: Vinay | last post by:
Hi All: I'm having a strange problem with the dropdownlist. Here is what is happening: I have a webform on which I have a whole bunch of controls. The form has 2 dropdownlists. The dropdowns...
9
by: Frances | last post by:
Hi All, * PREMISE * I'm creating an Access form with 150 items subdivided into 20 categories. Multiple categories (and items) can be selected so my user wants checkboxes. All of the options...
3
by: Damon | last post by:
I am working on a site in which I would like to have two dropdowns that will allow a user to navigate through the administrative pages of the site. The first would allow the user to choose the...
1
by: Andy | last post by:
What I want to do is to populate multiple dropdowns when editing. Presumably... a) I should use a DataReader so that I can get each ResultSet for each dropdown control, and that should cut down...
3
by: Simon Harvey | last post by:
Hi everyone, I keep getting a problem with dropdownlist controls. It sounds really stupid, but my app is screwed as long as this keeps happening. It seems to spontaneously happen and then I...
6
by: cretaceous | last post by:
Hi I'm a php/mysql developer and struggle when it comes to javascript ! I've looked all over for a solution but am rubbish at adapting javascript I've got two select dropdowns in a form The...
0
by: bogorman | last post by:
Am trying to add a "video" to a webpage which is based on a template containing a javascript menu. The site has hundreds of pages all based on this template and the menu works fine The page can be...
0
by: sbart | last post by:
I am programing in asp.net vb using AjaxToolkit cascadingDropDown. I do not have access to AjaxToolkit cascading dropdown event handlers. I have a series of dropdowns. The selection from one of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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.