Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 12th, 2007, 02:13 PM
Friend of Wrox
 
Join Date: Apr 2004
Location: San Francisco, CA, USA.
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cascading DropDownList in a GridView

Hi,

I'm trying to put a series of three cascading dropdownlist controls in the EditItemTemplates of a GridView.

This is for a small college's online registration system, and the dropdowns correspond to Departments (e.g. Math, English, Science etc.) , Courses (e.g. Calculus, Trig, Algebra etc.) and Sections (e.g. three sections of Calc I on different days and times, and different locations).

I've managed to get the sucker working outside of a GridView, by:

1) declaratively setting the datasource to a method that returns a dataView, e.g. DataSource = "<%# PopulateCourseDropDown(1) %>" where the 1 corresponds to the first Department in the parent dropdown, and

2) writing a SelectedIndexChanged event handler for each parent dropdown which calls the same method for its child, passing instead of a 1 the selectedValue from the parent, then re-binding.

This all works great, although I do wish they let you declaratively set the selectedValue property instead of forcing you to do it in code (minor nuisance).

Trouble is, when I put the whole thing in a GridView's EditItemTemplate, it stops working. The SelectedIndexChanged event still fires, and I can get into the handler method, I just can't seem to get a reference to the other dropdowns in the row, so I can't reset their datasources or re-bind them.

Do I need to bubble up the SelectedIndexChanged event into the GridViewRow, and handle it in a GridViewRow_Command event handler? Is that even possible? How would I differentiate between events coming from the various dropdowns?

Thanking you all for your input in advance!

Aaron Edwards

 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
DropDownList in Gridview sdoremus ASP.NET 3.5 Basics 0 September 15th, 2008 08:15 PM
Gridview and DropDownList extendedram ASP.NET 2.0 Basics 3 June 12th, 2007 05:05 PM
dropdownlist in asp:gridview DagEJ ASP.NET 2.0 Basics 0 January 28th, 2007 12:48 PM
Cascading DropDownList in a GridView Aaron Edwards ASP.NET 2.0 Basics 0 January 12th, 2007 02:11 PM
Gridview and dropdownlist GuyB ASP.NET 1.0 and 1.1 Basics 0 November 9th, 2006 08:54 PM



All times are GMT -4. The time now is 12:58 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.