

Automating Master-Detail Page Production
by Joseph Lowery
ISBN 0-471-76312-8
featured extension:
featured book:
for sales questions:
Email sales@webassist.com
U.S.
Monday - Friday, 9AM - 5PM PST
800.886.0130 Option 2
Europe
Monday - Friday, 9AM - 5PM GMT
+44 (0) 170.453.3838
Outside U.S. and Europe
Monday - Friday, 9AM - 5PM PST
+1.760.633.4013 Option 2
In a dynamic Web site, however, applications often require multiple pages to be effective. A prime example is the master-detail Web application where a search box on one page leads to a master list of results on a second page, each of which, in turn, is linked to a third dynamically generated detail page. Although Dreamweaver has made crafting master detail Web applications by hand extremely accessible, it can be a tedious series of steps, especially if you have to produce a number of applications for a site. To ease the monotony - and enhance your production efforts - Dreamweaver includes the Master-Detail Page Set application object that, after a single dialog box is completed, creates all the elements for a linked master-detail Web application.
The master page elements are inserted in the current document, which must contain a recordset. The inserted elements and code, shown in Figure 1, are as follows:
- A two-row table with a column for each field
- A header row comprised of all the field names selected in the dialog
- Dynamic text for all selected fields, placed into the second row
- A Repeat Region server behavior surrounding the second row
- A Go To Detail Page server behavior linking to the newly created detail page
- A Recordset Navigation Bar with text links and appropriate Show Region server behaviors in place
- A Recordset Status Bar showing the current record count

Figure 1
The Master-Detail Page Set application object adds all the designated fields and the required server behaviors to the current page.
The detail page is created when the Master-Detail Page Set Object is executed. As shown in Figure 2, the detail page is blank except for a two-column table, which contains a row for each field. The first column displays all the field names in the designated order, and the second column holds Dynamic Text elements, one for each of the fields.

Figure 2
Only the fields, data, and necessary server behaviors are included in the newly created detail page.
To create a Web application using the Master-Detail Page Set application object, follow these steps:
- Be sure that the current page, which will become the master page, includes the desired recordset and has been saved. The recordset must contain all the fields you want to display on the detail page, as well as the fields for the master page.
When creating master-detail pages, I generally create my initial recordset and choose all records. After I've created my page set, I trim down the recordset on the master page by selecting only those fields necessary for the master page.
- Place your cursor where you'd like the table, Recordset Navigation Bar, and Recordset Navigation Status element to appear.
- Choose Insert@@>Application Object@@>Master-Detail Page Set. You can also drag the Master-Detail Page Set icon from the Application category of the Insert bar to the desired location on the page. The Insert Master-Detail Page Set dialog box is shown in Figure 3.

Figure 3
Select the fields and their relative positions to lay out the columns for both the master and detail pages.
- Select the recordset you'd like to use from the Recordset list.
- In the Master Page Fields area, choose any fields you do not want to appear on the master and click the Remove (-) button.
Dreamweaver, by default, includes all the available fields in a selected recordset. If you'd like to include any fields that are not in the current recordset, you must click Cancel and modify the recordset. - If you change your mind after you remove a field from the list of fields to be inserted into the master page, click the Add (+) button and reinsert the field.
- Alter the positioning of the fields in the master page table by selecting the field and using the up and down arrows above the Master Page Fields area.
The master page table is horizontal with the topmost fields in the Master Page Fields area appearing on the left and the bottommost fields on the right. Clicking the up arrow moves a field to the left, whereas clicking the down arrow moves it to the right. - Choose a field from the Link To Detail From list that serves as a link to the detail page. Only the fields remaining in the Master Page Fields area are available in the Link To Detail From list.
- From the Pass Unique Key list, select the field that identifies each record for use in the URL parameter.
Although the field in the Link To Detail From list and the one in the Pass Unique Key list could be the same, they don't have to be. You can, for example, use an employee's last name as the link and the employee ID number-not displayed in the master page fields-as the unique key. The Pass Unique Key list includes all the fields in the chosen recordset whether or not they are displayed onscreen. - Select the number of records you'd like displayed in the Repeat Region. Choose All to display every record in the recordset. Now that you have defined the master page portion of your application, define the elements for the detail page.
- Enter the path to the detail page in the Detail Page Name field or click Browse to locate the file, if it exists.
The master and detail pages must be in the same folder for the Master-Detail Page Set application object to function properly.
- From the Detail Page Fields area, select any fields that you do not want to display on the detail page and click the Remove (-) button. Again, by default, Dreamweaver displays all the available fields in the recordset, and you must delete those you don't want to show.
- To change the order in which the fields are inserted into the detail page table, select the field and use the up or down buttons above the Detail Page Fields area.
- Click OK when you're done.
After the application object has finished inserting master page elements and creating the detail page, be sure to save the master page. Dreamweaver saves the detail page automatically, but it does not save the master page as part of the creation process.
The Master-Detail Page Set application object-especially the detail page-works well with Dreamweaver templates. After the master and detail pages are created, you can apply any Dreamweaver template to integrate the results into your site. To prepare the template, just make sure that at least one editable region exists for all the visual elements inserted into the master and detail pages. I say that the Server-Object-generated detail page is especially well suited to template use because the created page contains only the table and its dynamic elements. After applying such a template, as shown in Figure 4, you may still need to tweak the design by altering the table properties.

Figure 4
Drag a template from the Assets panel onto a detail page to quickly change the look-and-feel of a generated document.

