|
Data Adapter Configuration Wizard
Once you finish configuring your data adapter you can preview the data that will be
displayed on the Web Forms page. To preview your data select Data->Preview
Data from the main menu which opens the Data Adapter Preview window as displayed
in the image below.
On this window select OleDbDataAdapter1 from the Data Adapters drop-down box and click
the Fill Dataset button to preview data.
Creating DataSet
To create a DataSet, select Data->Generate DataSet from
the main menu. From the window that opens, select new and check the checkbox
for Table1 and also check the checkbox where it says "Add this dataset to the designer"
and click OK. Once you click OK, you can see the DataSet, DataSet11 being added to
the component tray. The image below displays that.
Drag a DataGrid and a Button control on to the Web Forms page designer from the toolbox.
Select the DataGrid and open it's properties window. For the DataSource property select
DataSet11 from the list and for the DataMember property
select Tabel1. Open the code designer and paste the following code.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As_
System.EventArgs) Handles Button1.Click
DataSet11.Clear()
OleDbDataAdapter1.Fill(DataSet11)
End Sub
|
Run the Web Forms page and click the button. The table will be displayed on the data
grid.
The data grid that displays the data looks pretty plain. You can customize your data
grid easily. To do that, select the data grid, right-click on it and from the menu
select the Auto Format item to open the Auto Format dialog as shown in the image below.
This dialog lets you select from a number of predefined styles for the data grid,
setting header color, border color and so on.
Property Builder
The Property Builder tool is another way of customizing the data grid. To open Property
Builder, right-click on the data grid and select property builder from the menu. The
property builder tool window is shown in the image below. The property builder allows
you to display some columns instead of the whole table (which is loaded in the
dataset), set border, whether or not to use paging, etc. Paging lets you
display a table in pages, where only a few records are visible in a data grid one
page at a time. The user will be provided with hyperlinks to see additional pages
in which the data grid displays additional records.
|