Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2007

Tip: Looking for answers? Try searching our database.

drop down list events

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Claudia Fong - 29 Oct 2007 14:25 GMT
I have 2 drop down list; my first ddl contains the list below:

A10
A20
A30
A40
A50

Those data were populated from the database.

My second ddl will display the data according to what user choose from
the first ddl.

I'm using the selected index changed event to call a method which will
go to the database and get the data from.
My "problem" is when I select the first one A10 it will not trigger the
selected index changed. I know that the index didn't change, but I was
wondering if there are a way to trigger this event or I can call my
method when the user click on the ddl even without the index change.

Cheers!

   Claudi
Eliyahu Goldin - 29 Oct 2007 14:54 GMT
Try preset SelectedIndex to -1 on page load.

Signature

Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

>I have 2 drop down list; my first ddl contains the list below:
>
[quoted text clipped - 21 lines]
>
> *** Sent via Developersdex http://www.developersdex.com ***
Claudia Fong - 29 Oct 2007 15:21 GMT
I did what you said, set the index to -1.. and it doesn't work.. is
still no trigger the event

Cheers!

   Claudi
Eliyahu Goldin - 29 Oct 2007 15:53 GMT
Another option is to add an empty item. In 2.0 you can do it without writing
any code:

<asp:DropDownList ... AppendDataBoundItems="true">
<asp:ListItem Value="">Please select item</asp:ListItem>
</asp:DropDownList>

Signature

Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

>I did what you said, set the index to -1.. and it doesn't work.. is
> still no trigger the event
[quoted text clipped - 4 lines]
>
> *** Sent via Developersdex http://www.developersdex.com ***
Claudia Fong - 29 Oct 2007 16:01 GMT
This ddl is populated according to what user chose from the previous
ddl.. so how can I display the select from list as the first one? Is
always something else.. I have to display other than the Select from...

Cheers!

   Claudi

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.