Exercise: Editable gridview of films

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 - C#  (25 exercises)
Topic ==> Editing using gridviews  (2 exercises)
Level ==> Average difficulty
Course ==> ASP.NET webforms - C#
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 in the files in the above folder.

Create a new form called frmFilms.aspx to contain an editable gridview (there are lots of notes overleaf about how to do this!):

ASP.NET 4.0 - C# exercise - Editing using gridviews (image 1)

Not convinced TITANIC deserved 11 Oscars? Us neither - so now's your chance to change this!

Here are some notes on how to do this:

  • You'll need to configure your data source (using the Advanced button) to allow update commands
  • Make sure you've set the DataKeyNames property of the gridview, to allow editing of records
  • For normal rows, you'll display a button with CommandName set to Edit
  • For edit rows, you'll display two image buttons (use the images in the folder), with command names set to Update and Cancel

Use your gridview to change:

  • the number of Oscars won by Titanic to 5
  • the name of Spider-Man to Spider Man (remove the hyphen)

Close your website down, and give yourself a pat on the back!

This page has 0 threads Add post