Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
DropDownList in Gridview sdoremus ASP.NET 3.5 Basics 0 September 15th, 2008 07:15 PM
Gridview and DropDownList extendedram ASP.NET 2.0 Basics 3 June 12th, 2007 04: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

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.