CODECUBE VENTURES

Building a master/detail pageset

Q:

How do I build a master/detail drilldown page using Dream weaver Ultradev?

A:

In order for this concept to be totally understood, you must understand how the database must be laid out. Ninety percent of any dynamic database work done in the web arena involves the use of the master/detail paradigm. For those of you that missed relational database 101, the most simple of master/detail relationships involve two tables, for this example we will use a "category" table for the master. This table can simply have two columns, one describing the category (simple text), and the other will be an Autonumber, or identity field (depending on which database you are using). Figure 1.1 shows some example data to be held by that table.

Figure 1.1 catIDcatDescription 1Computers 2Network 3Motherboards 4Games 5Utilities

The other piece of this puzzle, is the detail table, which in this example will be a table of products. In order to establish said relationship to the category table, this table needs to include the "Foreign Key" (the catID) in every item record. This allows you to select every item for any given category using the catID as the filter. Figure 1.2 shows a simple item table, and some sample data.

Figure 1.2 itemIDcatIDitemNameitemPrice 123Com ethernet card25 24Quake 350

From the example above, a search for catID 2 (Network) will result in the 3Com item, and a search for catID 4 will return Quake 3. Obviously, more records in the item table will result in bigger results for a given category search.

To implement said functionality in Ultradev, you will need two pages. The first page will be the category display, begin by:

  1. Create a recordset that selects all the columns and rows from the category table. This will give you two columns in the data sources palette.

  2. Drop a 1 row by 2-column table onto your category page, and drag the category description to the first column.

  3. Type "View Items" in the second column and highlight the text.

  4. Click on the link button on the property inspector floater.

  5. Choose the page that is to be the item page, and click on the "properties" button. This will bring up a window with several name/value pairs.

  6. Type "CatID" in the first name column, and click on the lightning bolt symbol on the second column. This will allow you to choose the "CatID" column from the recordset.

  7. Apply the "Repeat region" behavior to the table row, and you are done with the category page.

This will place the category ID for a given category in the querystring, which will make it look like this:

item.asp?catID=2

The value of "catID" will be accessible from the item page using the request object. Begin by:

  1. Creating a recordset that filters by the querystring value "catID"

  2. Create a table to hold the values from the item table (name, price)

  3. Drag the values to their respective column in the html table.

  4. Apply the repeat region.

Now obviously this example is simplified, the interface is not a whole lot to look at, and there can be a whole lot more data in the tables. But you should be enough for you to grasp the

Latest post: Digging Up the First Version of CodeCube

See more in the archives