Exercise: Gridview of films with studio dropdown

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 ==> Harder than average
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 into it the files in the folder above.

Create a new web page called frmFilms, to contain the following gridview (the studio name should be in a template column, for reasons we'll see shortly):

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

The default gridview, before you click on an edit button

Use the gridview to delete Titanic (if only it were that easy ...).

Create EditItemTemplate sections for the first and third columns of the gridview so that it looks like this when you're editing a film:

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

The studio name becomes a dropdown list

To get this to work, you'll have to add a dropdownlist based on a different data source, and change the SELECT statement in the gridview's data source so that it refers to a view linking the film and studio tables, and not just to the tblFilm table.

Use your gridview to reassign the film Trainspotting to Walt Disney Pictures.

That's it!  You can close everything down and make yourself a coffee ...

This page has 0 threads Add post