alt
Advertisement
Sponsored links
Online Training
Career Series
Exforsys
Exforsys arrow Tutorials arrow ASP.NET 2.0 arrow Displaying Master-Detail Data on Separate Pages in ASP.NET 2.0
Site Search


Displaying Master-Detail Data on Separate Pages in ASP.NET 2.0
Article Index
Displaying Master-Detail Data on Separate Pages in ASP.NET 2.0
Page 2

ASP.NET 2.0 Tutorials : Displaying Master-Detail Data on Separate Pages

In this tutorial you will learn how to display Master-Detail Data on Separate Pages, create the details page, test the pages and Allow Editing, Deleting, and Inserting Using a DetailsView DataBound control.

 

A variation of the GridView and DetailsView control is the display on separate pages. Each record has an hyperlink which enables them to navigate to a second page where they can view the detail records in a DetailsView control

1. Add a new page to the Web site and name it MasterCourses.aspx.

2. Switch to Design view.

3. Type Courses in the page and format the text as a heading.

4. From the Data folder of the Toolbox, drag a GridView control onto the page.

5. In the smart tag panel, from the Connect to Data Source list choose < New Data Source > and then use the wizard to do the following:

a. Click Database.

b. Connect to the ExForSys database.

c. Retrieve the CourseId, CourseName and CourseDuration columns from the CourseDetails table.

6. Optionally, in the smart tag panel select the Enable paging check box.

7. In the smart tag panel, choose Edit Columns.

8. The Fields dialog box is displayed.

9. Clear the Auto-Generate Fields check box.

10. Under Available Fields, choose HyperLink Field, click Add, and then set the following properties:

Property

Value

Text

 

Details

DataNavigateUrlFields

 

 

 

 

 

 

CourseId

This indicates that the hyperlink should get its value from the CourseId column

 

 

 

 

 

 

DataNavigateUrlFormatString

 

 

 

 

 

 

DetailsCourse.aspx?CourseId={0}

This creates a link that is hard-coded to navigate to the DetailsCourse.aspx page. The link also passes a query string variable named CourseId whose value will be filled using the column referenced in the DataNavigateUrlField property.

 

 

 

 

 

 

 

 

Click OK to close the Fields dialog box.

The details page can now be created that accepts a value from the master page. It should look like the screenshot here:



 
< Prev   Next >
Exforsys Offers
© 2008 Exforsys.com
Joomla! is Free Software released under the GNU/GPL License.
Page copy protected against web site content infringement by Copyscape