The above example, displays only the FirstName and LastName columns from the Employees table.
Note that the DataGrid control's AutoGenerateColumns property is set to the value False so that, all the columns from the Employees table are displayed, and the FirstName and LastName columns are displayed twice as shown below: -
Therefore it is important to take care of AutoGenerateColumns property of DatGrid control.
Further in the above example the BoundColumns are declared inside the DataGrid control's <Columns> tag. This tag contains a BoundColumn for the Titles column and a BoundColumn for the Price column. The DataField property indicates the field from the data source to display in the BoundColumn.
Adding a HyperLinkColumn to DataGrid Control
This is a very important concept in DataGrid Controls. To display links to other pages from the DataGrid, a HyperLinkColumncan be used.
This type of column is useful in two situations.
First, a HyperLinkColumn can be used, for example create a master-detail form. A set of master records can be displayed in a DataGrid and a HyperLinkColumn can be used in the DataGrid to link to a separate page that contains detailed information.
Secondly it can be used for interlinking pages and websites with each other, an important need of web programmers.
For example, you can use a HyperLinkColumn to display a list of useful ASP.NET Web sites.