Exercise: Cross page postback eg

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 ==> Passing values between pages  (3 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 the files in the above folder into it (you may alternatively be able to amend the website for the exercise you've just completed).

Create or use a page called frmRate, which allows you to rate any film:

ASP.NET 4.0 - C# exercise - Passing values between pages (image 1)

A familiar form ...

Set the PostBackUrl property of this page so that it posts back to a page called frmAcknowledgement.aspx.

Add ReadOnly properties to the page to return:

  • The film name typed in; and
  • The rating

You can assume that both the film name and rating are typed in correctly.

Now create (or amend) a page called frmAcknowledgement to include a previous page directive:

ASP.NET 4.0 - C# exercise - Passing values between pages (image 2)

Include this second line in the source for the page

When the page loads, write code which detects and then displays the film name and rating from the previous page:

ASP.NET 4.0 - C# exercise - Passing values between pages (image 3)

What the second page might display

Finally, see if you can break your system!

This page has 0 threads Add post