Exercise: Linking gridview to detailsview - film

This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

The answer to the exercise will be included and explained if you attend the course listed below!

Category ==> ASP.NET webforms - VB  (27 exercises)
Topic ==> DetailsView control  (2 exercises)
Level ==> Harder than average
Course ==> ASP.NET WebForms - VB
Before you can do this exercise, you'll need to download and unzip this file (if you have any problems doing this, click here for help).

You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Create a new website, and add the files in the above folder into it.  You will also need to run the SQL script to generate the Movies database, if you haven't already done so.

Create a gridview listing out the records in the tblCountry table:

ASP.NET 4.0 - Visual Basic exercise - DetailsView control (image 1)

When you click on the EDIT button next to a country ...

On the same page, create a DetailsView showing the details for a single country:

ASP.NET 4.0 - Visual Basic exercise - DetailsView control (image 2)

... you can then edit it as a single record

Tie the two in together, so that you only ever see one control at a time.  Some thoughts to help you:

  • You'll need two separate data sources: one for the gridview, and one for the DetailsView
  • After saving changes in the DetailsView, you'll need to run the DataBind method against the gridview before redisplaying it

You've now reached the holy grail of ASP.NET website design!

This page has 0 threads Add post