Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > BOOK: Professional ASP.NET 3.5 SP1 Edition: In C# and VB
|
BOOK: Professional ASP.NET 3.5 SP1 Edition: In C# and VB
This is the forum to discuss the Wrox book Professional ASP.NET 3.5 SP1 Edition: In C# and VB by Bill Evjen, Scott Hanselman, and Devin Rader; ISBN: 9780470478264
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 3.5 SP1 Edition: 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 May 19th, 2010, 12:47 PM
Authorized User
 
Join Date: Oct 2006
Posts: 42
Thanks: 3
Thanked 0 Times in 0 Posts
Default Master/Details display: can two Master lists feed the same Details control?

Hello,

I am trying to set up a Master-Details feature with two distinct lists of links on the "Master" side and one control on the "Details" side, all displaying on the same page. For example, the Master control(s) would display a list of links to item details, seperated into two sections:

Teachers
link1
link2
link3

Students
link1
link2
link3

...each of the links under both "Teachers" and "Students" would populate a single Details control with data appropriate to the selected link.

Right now I have a simple Master/Details on a single page using a single column gridview as the Master (<asp:ButtonField CommandName="Select" />) and a FormView control for Details. The Master Details relationship is handled declaratively with a <SelectParameters> in the Detail control's SQL Data Source. However, this arrangement only allows for a single column of Master links, i.e.:

Teachers & Students
link1
link2
link3
link4
link5
link6

I'm not sure how to solve this; is there any way to

1. have two Master controls feed to the same details control?
2. or perhaps have a Details control for each Master list, but swap visibility for each Detail control so it appears that there is only one Details control on the page?
3. or else have a Master control like a gridview or datalist display two sections of links, one on top of the other, each section with its own HeaderText, controlling the same Details control?

Thanks very much for any advice!
 
Old July 2nd, 2010, 03:00 PM
Authorized User
 
Join Date: Aug 2009
Posts: 17
Thanks: 0
Thanked 1 Time in 1 Post
Default

I'm not sure you'll be able to get the results you want declaratively. You'd probably want to be able to switch your Details control's DataSource property between two possible DataSources, which will probably have to be done in the codebehind anyway.

I'm also not sure I understand what you're trying to do...Usually, a Master-Details arrangements involves selecting one (or more) items from a list, and then displaying "details" in another set of a controls. For example, selecting Teacher1 from the Teachers list, will populate the details with a list of the students this teacher teaches.

Are you attempting to create a single "details control" where you can select either a Teacher from the Teachers list and have it display a list of their students OR you can select a student from the Students list and have it display a list of that student's teachers? If that's what you're wanting, then you'll need two SQLDataSources, and put code in the codebehind to swap between them based upon which selection was made most recently. The problem you'll have is that you'll want to clear the selection in the other control (when you select a Teacher, clear the selection from the Student's list); otherwise, the visual cues on the UI will make it difficult to determine the proper context (the code won't have that problem, because you'll probably handle it in a "selection changed" event).

Hope that helps.





Similar Threads
Thread Thread Starter Forum Replies Last Post
content pages don't display .master page elements kippy Visual Web Developer 2008 13 April 9th, 2009 12:23 PM
My GridView does not display in the content area of my master page? dotnetDeveloper ASP.NET 3.5 Basics 1 March 14th, 2009 02:42 PM
DataGridView Master/Details (Windows Forms) dvarrin C# 0 August 24th, 2006 07:08 AM
Help With Master Details Code In PHP Book placebo Wrox Book Feedback 1 November 21st, 2003 04:17 AM





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