This tutorials shows how we can Bind Data to controls and use those controls to manipulate this data. We use a GridView control and a DetailsView control to show data from a database, when the user clicks on a particular record. VB version.

In this tutorial, we are going to add a GridView control and a DetailsView control. We are going to bind a SQL database to both of these, and use the DetailsView control to display just one recorded from a table within the database when the user selects it. This will allow more data to be displayed via the DetailsView, rather than the GridView. Also, the user will then be able to edit, delete and even add new data to the database via DetailsView control.

For the ASPX page, we have one GridView control, and one DetailsView control. We also have a SqlDataSource, which is the connection to our database. For this example, the database consisted of just one table of people, built using the Server Explorer within Visual Studio.

The GridView has Paging and Selection enabled to allow the user to select a particular record from the data.

This is the only code needed for this example.

This will set the DetailsView control to display the record that the user has selected from the GridView.

Download Source Files