| The MXDataGrid ASP.NET Web server
control is specifically designed to display information from a data source.
You can bind the control to a data source at design time or at run time.
Although you can display data from a variety of data sources, the most
typical sources are datasets and data views.
In this walkthrough, you will bind a MXDataGrid to the Orders
table in the Orders database.
- Select File->New to get the "New File" dialog
- Select (General) from the Templates pane.
- Select the ASP.NET Page template.
- Type a file path in the Location box.
- Type myFirstDataGrid.aspx in the Filename box.
- Select Visual Basic in the Language drop-down box.
- Click OK.
- The myFirstDataGrid.aspx file will open in Design view.
- Type "Orders Listing" into the page, then hit the Enter key to insert
an empty space.
- Select the Data tab in the Workspace window.
- Connect to the Orders database you developed earlier in this
Guided Tour.
- Select the Orders table in the Tables node in the
Data tree view.
- Drag the Orders table onto the ASP.NET page.
- You will see a SQLDataSourceControl and MXDataGrid
appear on the ASP.NET page.
Note ASP.NET Web Matrix automatically sets the properties of the
SQLDataSourceControl based on the connection information specified
when connecting to the database.
Note ASP.NET Web Matrix automatically binds the MXDataGrid
to the SQLDataSourceControl.
- Save and run the ASP.NET page.
- Your ASP.NET page will automatically appear in a new instance of your
Web browser. The MXDataGrid will show all of the rows in the
Orders table. If you have more than 10 rows of data in the database,
then the MXDataGrid will automatically enable paging support to show only
10 rows of data at a time (and add navigation links for a user to browse
back and forth within the table).
- Close the Web browser instance.
Next Step >> |