Creating custom record counters

Creating custom record counters

To create a custom record counter for a page, you must first create a recordset for the page, an appropriate page layout to contain the dynamic content, and a recordset navigation bar. To learn more about creating these elements and adding them to a page, see Record counters. After you have created the above elements in the page, you can create a custom record counter.

This example creates a record counter that will appear similar to that created in the previous section, Creating a record counter using the Recordset Navigation Status object. The record counter in this example will appear as follows:

Displaying records StartRow thru EndRow of RecordSet.RecordCount.

In this example, the text in sans-serif font represents the record count placeholders that will be inserted in the page.

To create a custom record counter:

  1. In Design view, enter the counter’s text on the page. The text can be anything you want. For example:
    Displaying records thru of .
    
  2. Place the insertion point at the end of the text string.
  3. Open the Server Behaviors panel (Window > Server Behaviors).
  4. Click the Plus (+) button in the upper-left corner, and click Display Record Count. Within this submenu, select Display Total Records. The Display Total Records behavior is inserted into the page, and a placeholder is inserted where the insertion point was. The text string should now appear as:
    Displaying records thru of {Recordset1.RecordCount}.
    
  5. Place the insertion point after the word records, and select the Display Starting Record Count Number from the Server Behaviors > Plus (+) button > Record Count panel. The text string should now appear as:
    Displaying records {StartRow_Recordset1} thru of {Recordset1.RecordCount}.
    
  6. Now place the insertion point between the words thru and of, and select the Display Starting Record Count Number from the Server Behaviors > Plus (+) button > Record Count panel. The text string should now appear as:
    Displaying records {StartRow_Recordset1} thru {EndRow_Recordset1} of
    {Recordset1.RecordCount}.
    
  7. Confirm that the counter functions correctly by viewing the page in the Live Data window (View > Live Data); the counter should now look similar to the following example:
    Displaying records 1 thru 8 of 40.
    

    If the results page has a navigation link to move to the next set of records, clicking the link would update the record counter to read as follows:

    Showing records 9 thru 16 of 40.
    

    Links don’t work in the Live Data window. To test them, you can use the Preview in Browser feature in Dreamweaver. Make sure the Preview Using Live Data Server option is selected in Preferences (Edit > Preferences > Preview in Browser (Windows) or Dreamweaver > Preferences > Preview in Browser (Macintosh)); then select File > Preview in Browser.



Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Defining Sources of Dynamic Content
Developing Applications Rapidly
 
ASPTreeView.com
 
Evaluation has ёїЗ№¶ПФХјexpired.
Info...