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 Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking 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 Basics 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 Search this Thread Display Modes
  #1 (permalink)  
Old September 19th, 2007, 08:59 AM
Registered User
Join Date: Sep 2007
Location: Cambridge, , United Kingdom.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Master Detail Records

I'm new to this. I need create a master/details web page (using Visual Web Developer) that shows the master record in a DetailsView and related details records in a GridView and be able to add new detail records. New detail records should take the Primary key from the master record and write it to the detail record.

Anyone familiar with MS Access will know the sort of thing - Subforms.

If a slightly different strategy is used in web forms, that's fine - maybe a button or hyperlink that says add new, which would then show another details view (populated with primary key).

I've spent ages looking for an answer to this simple problem. Any help would be greatly appreciated.

I would prefer to use sqlDataSource, but happy going with ObjectDataSource/BLL.


Reply With Quote
  #2 (permalink)  
Old October 11th, 2007, 05:23 AM
Registered User
Join Date: Sep 2007
Location: Cambridge, , United Kingdom.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts


Can anyone answer this query?

Have I posted this in the correct forum?

Thanks in anticipation

Reply With Quote
  #3 (permalink)  
Old October 12th, 2007, 10:00 PM
Friend of Wrox
Join Date: Aug 2006
Location: Bangalore, Karnataka, India.
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post

what i understand that you have grid and details view. all record are in Gridview and details are in details view. oyu want any body click on gridview's add button it takes primary key and your added details will be in details view. am i correct?

Reply With Quote
  #4 (permalink)  
Old November 8th, 2007, 05:58 AM
Registered User
Join Date: Sep 2007
Location: Cambridge, , United Kingdom.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts


Sorry to take so long to get back to you. The scenario is that the details view is the 'master' record (for example customer) and the grid view shows the detail records (e.g. customer orders). Like this:

Customer: My Customer
Address: 23 the street, Town, County.
Tel: 01234 567890

Order No Product Cost
1 prod1 £20
2 Prod2 £22

I have seen a fair few examples the other way around, where clicking on the order (shown in a gridview at top of form) would show all details of the order.

Thanks for your post. Hope you can follow-up.

Reply With Quote
  #5 (permalink)  
Old November 10th, 2007, 10:58 AM
Authorized User
Join Date: Jul 2007
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts

Dear Amsterdaz,
the primary key of the master record that you are looking for can be captured using the "SelectedValue" property of the DetailsView

string PK=DetailsView1.SelectedValue;

this statement will get the data key value of the current record in the detailsview

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
master-detail hhpatek ADO.NET 0 April 3rd, 2008 02:53 PM
Master Detail prasanta2expert Access VBA 1 October 1st, 2007 06:37 AM
master detail windows from using C# kamran Yousaf Bk Classic ASP Professional 0 January 12th, 2007 06:39 AM
master/detail beeyule Dreamweaver (all versions) 1 January 18th, 2005 02:59 AM

All times are GMT -4. The time now is 01:36 PM.

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