Wrox Programmer Forums
|
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 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 September 19th, 2007, 08:59 AM
Registered User
 
Join Date: Sep 2007
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.

Thanks

Daz
 
Old October 11th, 2007, 05:23 AM
Registered User
 
Join Date: Sep 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

Can anyone answer this query?

Have I posted this in the correct forum?

Thanks in anticipation


Daz
 
Old October 12th, 2007, 10:00 PM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

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?

thanks......
 
Old November 8th, 2007, 05:58 AM
Registered User
 
Join Date: Sep 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

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.


Daz
 
Old November 10th, 2007, 10:58 AM
Authorized User
 
Join Date: Jul 2007
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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









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





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