alt
Advertisement
Sponsored links
Online Training
Career Series
Exforsys
Exforsys arrow Tutorials arrow ASP.NET 2.0 arrow ASP.NET Displaying Master-Detail Data on the Same Page
Site Search


ASP.NET Displaying Master-Detail Data on the Same Page
Article Index
ASP.NET Displaying Master-Detail Data on the Same Page
Page 2

.

.

To configure a query to display related records

1. Press ENTER to make space underneath the SqlDataSource1 control.

2. From the Data group of the Toolbox, drag a DetailsView control onto the page.

3. Configure it to use a second data source control using the following steps:

.......a. From the Choose Data Source list, select < New Data Source >.

.......b. Select Database.

.......c. Click OK.

.......d. In the Choose a data connection list, click the connection you created and stored
.......earlier in the walkthrough.

.......e. Click Next.

.......f. From the Name list under Table or View Options, select StudentMaster.

.......g. In the Columns box, check StudentId, StudentName and CourseId.

.......h. Click WHERE.

.......The Add WHERE Clause dialog box is displayed:

.......i. From the Column list, select CourseId

.......j. From the Operator list, select =.

.......k. From the Source list, select Control.

.......Under Parameter Properties, in the Control ID list, select GridView1. The query for the
.......second grid will get its parameter value from the selection in the first grid.

.......l. Click Add and then click OK to close the Add WHERE Clause dialog box.

.......m. Click Next.

.......n. In the Preview page, click Test Query.

.......The wizard displays a dialog box that prompts you for a value to use in the WHERE clause.

.......o. Type 22 in the box and click OK.

4. The Student records for CourseId 22 are displayed.

5. Click Finish.

6. In the Common DetailsView Tasks menu, check Enable Paging.

7. This will allow the user scroll through individual Student records.

8. Optionally, in the Properties window, open the PagerSettings node and select a different Mode value.

9. By default, you page through records by clicking a page number, but the user can select options to use next and previous links.

10. The page can now be tested.

To test the page

1. Press CTRL+F5 to run the page.

2. In the grid, select a category.

3. The DetailsView control displays a Student record associated with that CourseId.

4. Use the pager links in the DetailsView control to navigate to other student records for the same courseId.

5. In the grid, select a different CourseId.

6. Review the Student records for that CourseId in the DetailsView control.


Trackback(0)
Comments (0)add comment

Write comment

busy

 
< 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