 |  |
provided by:

For Dummies is a registered trademark of Wiley Publishing, Inc. in the United States and other countries. Used here by license.For ASP.NET, you can use the DataSet Web control to specify table columns and the DataGrid Web control to list the database records to display on the master page. The Web controls provide an easy way to display database data with controls for paging between multiple pages of records. You need to define a database connection for the site before you create the master page.
Creating a master pageTo create an ASP.NET master page, follow these steps:
1. Create a new or open an existing ASP.NET page in Dreamweaver.
2. In the Bindings panel, click the plus (+) button and select DataSet (Query) from the menu that appears. The DataSet dialog box appears.
3. Complete the DataSet dialog box and then click OK.
Make sure to include all table columns that you need to create your master page, including the unique key (Record ID column) for each record. The new dataset appears in the Binding panel.
4. In the Server Behaviors panel, click the plus (+) button and select DataGrid from the menu that appears.
The DataGrid dialog box opens.
5. Select the dataset source from the DataSet drop-down list and click OK. You can leave the default column type as Simple Data Field.
Creating links that open the detail page
After you create the ASP.NET master page (as described in the preceding section), you need to create links that open the detail page and communicate which record the user selected. To open an ASP.NET detail page and display the specified record, follow these steps:
1. Open the master page in the Document window.
2. In the Server Behaviors panel, double-click DataGrid.
The DataGrid dialog box appears.
3. In the Columns list, select the column that you want to serve as the link to the detail page.
You can use any field that identifies the record for expanding the detail of the record.
4. Click the Change Column Type button.
5. Select Hyperlink from the pop-up menu.
The Hyperlink Column dialog box appears.
6. In the Hyperlink Text section, specify the text that you want to display in the hyperlink column.
Here are your choices:
• Static Text: Select this radio button if you want to use a generic description for this column. Enter text for the link, such as Details.
• Data Field: Select this radio button if you want to add text for a link based on a hyperlink column. Then from the drop-down list, select a data field in your dataset.
• Format String: This field is automatically generated and shows the format of the URL text.
7. In the Linked Page section, specify the URL for the hyperlink column text. Here are your choices:
• Static Text: Select this radio button if you want to use a generic link for this column. Enter the URL for the link, such as Details.aspx.
• Data Field: Select this radio button if you want to add a link for data displayed in the hyperlink column. Then from the drop-down list, select a data field in your dataset. In the example, we selected the first_name column.
• Format String: This field is automatically generated and shows the format of the URL link. The URL opens the detail page and uniquely identifies the record to display on the detail page.
8. In the Linked Page section, click the Browse button next to the Format
String box.
9. Locate and select which detail page you want to display.
Note the following when selecting your link page:
• When you select a detail page, Dreamweaver adds information to the URL that specifies a parameter to use to identify the record.
• Dreamweaver automatically names this parameter based on your database field name, but you can change the name to something else if you want to.
• In any case, be sure to note the name of this URL parameter because you need that name when you create the detail page (which you can read about in the following section, “Creating a detail page”).
• Dreamweaver uses a {0} placeholder to indicate where it places the value of the unique identifier when someone accesses the page.
11. Click OK.
The DataGrid dialog box closes. The DataGrid on your page is updated.
Creating a detail pageAfter you create a master page for ASP.NET (as described in the two previous sections), you need to create a detail page to display the record. To do so, you need to define a dataset for the record and bind its columns to the detail page. When creating the detail page, you need to know the database column name that you want to reference and the URL parameter that the master page uses to find and display that column’s record on the detail page. If you don’t remember the URL parameter name, open the master page, go to the Bindings panel, and look under the DataSet listing. To create an ASP.NET detail page, create a new ASP.NET page in Dreamweaver and follow Steps 2 through 12 in the earlier section, “Building detail pages.” Note that although the earlier steps show you how to fill out the Recordset dialog box, the steps are the same for the DataSet dialog box, which you fill out when creating an ASP.NET detail page.
Testing Your Master and Detail PagesAfter you create a master and detail page set, you need to test those pages. Follow these steps to preview the pages in a browser:
1. Open the master page.
2. Choose FileªPreview in BrowserªYour browser type.
3. When Dreamweaver asks you if it’s okay to copy the file to the testing site, click OK.
Your browser launches with your master page
4. Click a hyperlink to view the associated detail page for that record.
In the employee example, the linked field is the employee’s last name. When you click a link, the browser page changes to expand the record and display the detail page. Be sure that both your master page and detail page transfer to the testing server. If not, when you click a link in the master page, you get a Page not found error message.
 |  |
provided by:

For Dummies is a registered trademark of Wiley Publishing, Inc. in the United States and other countries. Used here by license.