paging through a data table creating a navigation bar using the recordset navigation bar server...
TRANSCRIPT
Paging Through a Data Table
Creating a Navigation Bar Using the
Recordset Navigation BarServer Behavior
Paging Through a Data Table
When a data table contains too many records to display onscreen at once, you need a way to page through the data.To help you do this, Dreamweaver has an Application object called the Recordset Navigation Bar server behavior.The following tutorial steps you through the process of creating a Recordset Navigation Bar that the user can use to page through a data table onscreen.
Create an ASP Page
Pull down the File menu and choose New to bring up the New Document dialog.Select the Dynamic Page category to make the Dynamic Page options appear.Select ASP JavaScript and click the Create button; the new page appears.Pull down the File menu, choose Save, and save the file in your site’s local root folder; in this example, make the name of the page be DataTablePaging.asp.
Defining the Data Source
If you have not already defined the data source containing your table, follow these steps:
Click to position your cursor in the Databases window. If the Databases window is not visible, pull down the Window menu and choose Databases.Click the plus-sign button and choose Custom Connection String.When the Custom Connection String dialog appears, enter the name of the connection and your connection string.
Entering the Connection String
In this course, the connection string is:
"DBQ=C:\webs.oet.udel.edu\fthstudents\databases\lastname\TopSecret.mdb;DRIVER={Microsoft Access Driver (*.mdb)}“
-or-
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\webs.oet.udel.edu\fthstudents\databases\lastname\TopSecret.mdb“
If you are running your own Web server, you can use the my.udl wizard to create the connection string.
Create a Recordset Data Binding
Click the Bindings tab of the Application window, or pull down the Window menu and choose Bindings.Click the plus sign button and choose recordset to make the recordset dialog appear.Customize the Name field to suit your application. If this is a list of users, for example, make the Name field say UsersRecordset.Choose the connection that contains the table.Select the data table containing your data.Select the data fields you want displayed.Click OK.
Select the Application Toolbar
If the Insert toolbar is not already set to Application, pull down the Insert bar and choose Application to make the Application toolbar appear:
Display the Data Table
Click to position the cursor at the spot on the page where you want to display the data table.From the Application category of the Insert bar, choose Dynamic DataDynamic Table:
Define the Dynamic Table
When the Dynamic Table dialog appears, choose the recordset you want to display, set the number of records to show at a time, and click OK:
Test the Page
Press F12 to test the page and make sure it works so far. F12 publishes and tests the page all in one step.When the page appears in your browser, you should see the table onscreen.If you do not see the table, troubleshoot the problem until you get this test to succeed.
Insert the Recordset Navigation Bar
Click to position the cursor at the spot on the page where you want to display the navigation bar.Pull down the Recordset Paging menu and choose Recordset Navigation Bar:
Set the Recordset Navigation Bar Options
When the Recordset Navigation Bar dialog appears, choose the recordset you want to display, and set the option to display the navigation options as text or images, as you wish, and click OK:
Test the Page
Press F12 to test the page. You should now have buttons you can use to page back and forth through the data table:
Adjust the Page Layout
Stylize the page elements as you wish.Use a surrounding table, for example, to make the navigation bar and the table appear centered with respect to each other as follows: