473,322 Members | 1,259 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,322 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 1530
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.