Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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, 05:15 PM
Registered User
 
Join Date: Aug 2010
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Default Using Multiple DropDownLists in DetailsView

Hi Imar,

In my Golf Club Web App (which I am building as I read your book), 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. Do you have an approach / reference you could steer me towards? I'm still a beginner -- so still struggling on some of this stuff. Thanks.
 
Old December 1st, 2010, 05:40 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Since this is not directly related to the book, would you mind posting this in a more general ASP.NET 4 category: http://p2p.wrox.com/asp-net-4-539/? Makes it easier for others to join the discussion and find what they are looking for.

That said, I probably wouldn't use a DetailsView for this, but hand code the page instead as explained in my book.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old December 1st, 2010, 06:13 PM
Registered User
 
Join Date: Aug 2010
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Imar,

Would you please direct me to the pages in this book that describe manual coding for this scenario?

I did post this in the more general forum, also.

Thanks.
 
Old December 2nd, 2010, 04:03 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You find a discussion on hand-coding data access pages on page 554 and further.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
dstreeter (December 3rd, 2010)
 
Old December 3rd, 2010, 08:51 AM
Registered User
 
Join Date: Aug 2010
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Imar,

I "fast forwarded" to the hand coding data access section (P. 554) in the book. Your example to allowed me to successfully create the insert code for my application. This was exactly what I needed to connect the dots and make progress.

Thanks!

"Experience is something you don't get until just after you need it" - Oliver's Law





Similar Threads
Thread Thread Starter Forum Replies Last Post
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
Databinding 3 Dropdownlists rit01 ASP.NET 2.0 Basics 1 May 30th, 2006 10:47 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.