Tutorial - Master/Detail

In this tutorial we will show you how to setup Master/Detail table view in ASPMaker. We will use the demo database for demonstration.

In the demo.mdb, there are two tables called "Orders" and "Order Details". We will set up the master/detail relation between these two tables.

Fields in Table "Orders"

Fields in Table "Order Details"


Steps to Setup Master/Detail Records

1. Loading ASPMaker

Open ASPMaker and connect to the demo.mdb database.

2. Setting up Master/Detail Relationship

Select either the master or detail table in the Database tree view (the left pane). In this example, we choose the master table - "Orders" table. Then we select the Table tab in the right pane.

Then in [Master/Detail] panel at the bottom right corner of the page, click [Modify...] to bring up the visual master/detail relationship editor. Drag the detail table from the table list on the left to the diagram on the right.

Then create a relationship between them by dragging from the master field (key field in master table) to the detail field (foreign key field in the detail table).

If there are more linked field, repeat the step until all the relationships are setup. In this tutorial, we only have one detail field ([Order Details].OrderID) and one master field (Orders.OrderID).

ASPMaker supports multiple master/detail, if the table has other master tables or detail tables, just repeat above process. In this example, we have only one master/detail relationship, so we click [OK] to confirm. The master/detail relationship is setup.

If you want referential integrity, you can enable Referential Integrity, Cascade Delete and/or Cascade Update, see Table Setup -> Master/Detail for detail.

If you want to enable Master/Detail-Add and/or Master/Detail-Edit, enable Grid-Add and/or Grid-Edit for the detail table in the Table Setup page:

If the master table has more than one detail tables, you can choose Multiple detail tables. By default each detail table occupies a column in the main table of the List page, if Multiple detail tables is enabled, the columns will be combined as one.

If you have the Preview extension (for registered users only) and want to enable detail record preview by Ajax, you can click Tools -> Extensions to enable it. Also see Third-Party Tools.

Enable the extension and then click the Advanced tab to set your settings for each table:


  1. The Preview extension works best when the number of the fields and number of records are not too many so the size of the preview area will not be too large. Otherwise the preview area may exceed the browser area and therefore the detail records cannot be viewed completely at a glance.
  2. If PreviewRow is enabled, the individual detail table columns will become hidden.

3. ASP Script Generation

Click the [Generate ASP] icon to go to the [Generate] tab, click the [Generate] button. ASPMaker will generate the required ASP scripts automatically.

4. Running the ASP Application

Click on the link to the "orders" table, there will be a new column for the "orderdetails " table. Click on the "orderdetails" button to access the order details for the selected record. Click the down arrow button and then click Master/Detail View, Master/Detail Edit or Master/Detail Copy to view/edit/copy and selected record and its detail records.

If you have enabled Preview extension and enable PreviewOverlay, move your mouse cursor over the "orderdetails" button and you'll see detail records preview:

If you have enabled Preview extension and enable PreviewRow, click the [+] button in the row and and you'll see the preview row:

Click the Master/Detail View link/button, the View page of the master table with a detail table grid of the detail table will be shown.

Click the Master/Detail Edit link/button, the Edit page of the master table with a detail table grid of the detail table will be shown.

Click the Master/Detail Copy link/button, the Add page (in Copy mode) of the master table with a detail table grid of the detail table will be shown.

Click the Add orders/orderdetails button in the paging section, the Add page of the master table with a detail table grid of the detail table will be shown.

In Master/Detail-Add/Copy/Edit mode, you can click Add Blank Row or Delete button to add or delete rows without refreshing the page. Note this feature is implemented by JavaScript.


 ©2001-2017 e.World Technology Ltd. All rights reserved.