Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion 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
Old December 1st, 2010, 06:09 PM
Registered User
Join Date: Aug 2010
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Default Using Multiple DropDownLists in DetailsView


In my Golf Club Web App (which I am building as I read Beginning ASP.NET4 in C# and VB), I have a webform that will allow a club member to enter in his golf round score. I am trying to use the DetailsView datacontrol for the record insert. The table to be updated is called "Rounds". The main fields in the Rounds table are: 1) CourseID; 2) TeeID; 3)RoundDate; and 4) Score. In my DetailsView, I have converted CourseID and TeeID fields into templates so that I can replace the textbox's with DDLs.

Two of these fields relate to two "child" tables -- once called "Courses" and the other "Tees". The CourseID field relates to the Id field in the "Courses" table and the TeeID field relates to the Id field of the Tees table. For each course there may be many Tee records (Golf Course A with several possible Tee Boxes, i.e., Black, Blue, White, etc.).

The user will select the course played from DropDownList1 that uses a datasource with the Courses Id and Name fields (no problem with that...). The Courses table has an Id for each course that is related to a CourseID field in the Tees table.

I want DropDownList2 (datasource with Tees Id, CourseID and Name fields) to only display the Tees that have the CourseID equal to the course selected in DropDownList1.

So, DDL1 feeds a course name (value) to DDL2 datasource which should filter on this Id to display only the Tees applicable to this course. The VWD 2010 Express doesn't seem to do all this "behind the scenes". And when I think I've got it set up, I get this error: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. .

I've seen this scenario described in other web postings with rather complicated potential solutions. Does anyone have an approach / reference you could steer me towards? I'm still a beginner -- so still struggling on some of this stuff. Thanks.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Multiple DropDownLists in DetailsView dstreeter BOOK: Beginning ASP.NET 4 : in C# and VB 4 December 3rd, 2010 08:51 AM
Cascading dropdownlists not working in the edit template of detailsview thd_tq123 ASP.NET 3.5 Professionals 1 February 27th, 2009 07:55 AM
Dropdownlists in DetailsView irelandk BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 February 20th, 2007 10:13 AM
Callback in 3 DropDownLists Paula222 ASP.NET 2.0 Professional 3 December 13th, 2006 08:53 AM
DropDownLists venterjo General .NET 1 January 8th, 2005 09:10 AM

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