Contents Index Topic Contents |
Address Book Navigation Buttons
The Address Book application displays the navigation buttons at the bottom of the Web page. You can use the navigation buttons to navigate around the data in the grid display, by selecting either the first or last row of data, or rows adjacent to the current selection.
The following code defines the navigation buttons. These HTML statements appear before the VBScript section of the program. Copy and paste these controls following the comment tag which refers to them.
<INPUT TYPE=BUTTON NAME="First" VALUE="First"> <INPUT TYPE=BUTTON NAME="Prev" VALUE="Previous"> <INPUT TYPE=BUTTON NAME="Next" VALUE="Next"> <INPUT TYPE=BUTTON NAME="Last" VALUE="Last">HTML uses the INPUT tag to define a form element, such as a button, option button, check box, or text. You use the TYPE parameter to specify the type of form element, which in this case is a button. The NAME parameter defines what the button will be called in code. The VALUE parameter specifies the labels associated with the button (First, Previous, Next, and Last) that are displayed on the page.
When a user clicks a button, an event is generated, and VBScript activates the appropriate navigation Sub procedure.
Navigation Sub Procedures
The Address Book application contains several procedures that allow users to click the First, Next, Previous, and Last buttons to move around the data. To enable movement, you can specify the method of the RDS.DataControl object (
SControl
) to the type of movement you want. The method differs for each navigation button.For example, clicking the First button activates the VBScript First_OnClick Sub procedure. The procedure executes a MoveFirst method, which makes the first row of data the current selection. Clicking the Last button activates the Last_OnClick Sub procedure, which invokes the MoveLast method, making the last row of data the current selection. The remaining navigation buttons work in a similar fashion. Copy and paste this code within the <Script> </Script> tags.
' Move to the first record in the bound recordset. Sub First_OnClick SControl.Recordset.MoveFirst End Sub ' Move to the next record from the current position ' in the bound recordset. Sub Next_OnClick If SControl.Recordset.EOF Then 'cannot move beyond bottom record SControl.Recordset.MoveFirst SControl.Recordset.MoveNext Exit Sub End If SControl.Recordset.MoveNext End Sub ' Move to the previous record from the current position in the bound ' recordset. Sub Prev_OnClick If SControl.Recordset.BOF Then 'cannot move beyond top record SControl.Recordset.MoveLast 'Get out of BOF buffer SControl.Recordset.MovePrevious Exit Sub End If SControl.Recordset.MovePrevious End Sub ' Move to the last record in the bound recordset. Sub Last_OnClick SControl.Recordset.MoveLast End Sub
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.