Title - Navigating database recordset, info
go to home    

Recordset navigation links let users move from one record to the next, or from one set of records to the next. For example, after designing a page to display five records at a time, you might want to add links such as Next or Previous that let users display the five next or previous records.

You can create four types of navigation links to move through a recordset: First, Previous, Next, and Last. A single page can contain any number of these links, provided they all work on a single recordset. You can’t add links to move through a second recordset on the same page.

Recordset navigation links require the following dynamic elements:

  • A recordset to navigate

  • Dynamic content on the page to display the record or records

  • Text or images on the page to serve as a clickable navigation bar

  • A Move To Record set of server behaviors to navigate the recordset

    You can add the last two elements by using the Record Navigation Bar server object, or you can add them separately by using the design tools and the Server Behaviors panel.
     

Create a recordset navigation bar

You can create a recordset navigation bar in a single operation using the Recordset Navigation Bar server behavior. The server object adds the following building blocks to the page:

  • An HTML table with either text or image links

  • A set of Move To server behaviors

  • A set of Show Region server behaviors

    The text version of the Recordset Navigation Bar looks like this:

Before placing the navigation bar on the page, make sure the page contains a recordset to navigate and a page layout in which to display the records.

After placing the navigation bar on the page, you can use the design tools to customize the bar to your liking. You can also edit the Move To and Show Region server behaviors by double-clicking them in the Server Behaviors panel.

Dreamweaver creates a table that contains text or image links that allow the user to navigate through the selected recordset when clicked. When the first record in the recordset is displayed, the First and Previous links or images are hidden. When the last record in the recordset is displayed, the Next and Last links or images are hidden.

You can customize the layout of the navigation bar by using the design tools and the Server Behaviors panel.

  1. In Design view, place the insertion point at the location on the page where you want the navigation bar to appear.
  2. Display the Recordset Navigation Bar dialog box (Insert > Data Objects > Recordset Paging > Recordset Navigation Bar).
  3. Select the recordset you want to navigate from the Recordset pop‑up menu.
  4. From the Display Using section, select the format to display the navigation links on the page, and click OK.

    Text

    Places text links on the page.

    Images

    Includes graphical images as links. Dreamweaver uses its own image files. You can replace these images with image files of your own after placing the bar on the page.

 

Custom recordset navigation bars

You can create your own recordset navigation bar that uses more complex layout and formatting styles than the simple table created by the Recordset Navigation Bar server object.

To create your own recordset navigation bar, you must:

  • Create navigation links in text or images

  • Place the links in the page in Design view

  • Assign individual server behaviors to each navigation link

This section describes how to assign individual server behaviors to the navigation links.

  1. In Design view, select the text string or image on the page you want to use as a record navigation link.
  2. Open the Server Behaviors panel (Window > Server Behaviors), and click the Plus (+) button.
  3. Select Recordset Paging from the pop‑up menu; then select a server behavior appropriate to that link from the listed server behaviors.

    If the recordset contains a large number of records, the Move To Last Record server behavior can take a long time to run when the user clicks the link.

  4. In the Recordset pop‑up menu, select the recordset that contains the records, and click OK.

    The server behavior is assigned to the navigation link.

Set the Move To (server behavior) dialog box options

Add links that let the user navigate through records in a recordset.

  1. If you didn’t select anything on the page, select a link from the pop‑up menu.
  2. Select the recordset that contains the records to page through, and click OK.

    Note:

    If the recordset contains a large number of records, the Move To Last Record server behavior can take a long time to run when the user clicks the link.

 

When creating a custom navigation bar, begin by creating its visual representation using the Dreamweaver page-design tools. You don’t have to create a link for the text string or image, Dreamweaver creates one for you.

The page you create the navigation bar for must contain a recordset to navigate. A simple recordset navigation bar might look like this, with link buttons created out of images, or other content elements:

After you have added a recordset to a page, and have created a navigation bar, you must apply individual server behaviors to each navigation element. For example, a typical recordset navigation bar contains representations of the following links matched to the appropriate behavior:

Navigation link

Server behavior

Go to first page

Move to first page

Go to previous page

Move to previous page

Go to next page

Move to next page

Go to last page

Move to last page

 

Display and hide regions based on recordset results

You can also specify that a region be displayed or hidden based on whether the recordset is empty. If a recordset is empty (for example, no records were found matching the query), you can display a message informing the user that no records were returned. This is especially useful when creating search pages that rely on user input search terms to run queries against. Similarly, you can display an error message if there is a problem connecting to a database, or if a user’s user name and password do not match those recognized by the server.

The Show Region server behaviors are:

  • Show If Recordset Is Empty

  • Show If Recordset Is Not Empty

  • Show If First Page

  • Show If Not First Page

  • Show If Last Page

  • Show If Not Last Page

  1. In Design view, select the region on the page to show or hide.
  2. In the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button.
  3. Select Show Region from the pop‑up menu, select one of the listed server behaviors, and click OK.

 

 
@ pure software code