Displaying Records
See Also
You can display data on your Web page by using data-bound design-time controls, such as labels, text boxes, and list boxes, and provide navigation among the records by using a navigation control.
To add a data-bound control to an ASP or HTML page
-
Make sure that you have set options to view controls graphically. From the View menu, choose View Controls Graphically. To set this option as default, use the HTML node of the Options dialog box.
-
Open an ASP or HTML page that contains a Recordset control in the editor.
-
Drag a data-bound control from the Design-Time Controls tab of the Toolbox onto the page. For example, you can drag a Textbox control onto the page to display the contents of a particular field.
-
Right-click the control and choose Properties.
-
Set the Recordset property of the control to the name of a Recordset control on the current page.
-
If the control has a Field property, set it to the name of the field from the recordset you want the control to display.
-
Set other control properties as desired.
For more information on data-bound controls and setting their properties, see Design-Time Controls and Dialog Boxes and Windows.
-
Close the properties window, save the .asp or .htm file, and preview the file in the browser. The text box will display the field you selected for the first record in the connected database.
For information on previewing ASP or HTML pages in a browser, see Previewing a Page in a Browser.
You can easily provide navigation among the records you display on your Web page by using the RecordsetNavbar control.
To provide navigation among records
-
Open the ASP or HTML page in the editor.
-
Drag the RecordsetNavbar control from the Design-Time Controls tab of the Toolbox onto the page.
-
Right-click the control and choose Properties.
-
Set the Recordset property of the control to the name of a Recordset control on the ASP or HTML page.
-
If you want, close the properties window, save the .asp or .htm file, and preview the file in the browser. You can use the RecordsetNavbar control to move among the records in the underlying recordset.
By default, the RecordsetNavbar control provides Move to First, Next, Previous, and Move to Last buttons. You can use these buttons to display the different records in the underlying recordset on the page.
You can also customize navigation behavior by writing event handlers and using the object model exposed by this control. For more information, see RecordsetNavbar control.
You can also use the Grid design-time control to display multiple records from a database on your page. For more information, see Grid Design-Time Control, the Data-bound Grid Sample and Grid Properties Dialog Box.
For more information about displaying your data on Web pages, see Viewing Data, Modifying Data, and Creating Event-Driven Forms.