Exercise: Validation groups - star wars dating

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 ==> Validation controls  (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 the files in the above folder into it.

Browse the web page called frmRequest.aspx - you should see that it lets you request a date either by:

  • typing in a minimum and maximum required age; or
  • specifying a star sign (in the Empire, lifeforms are neither fussy nor always logical)

Add validation controls to the page as follows:

  • a control to check that the minimum age is filled in
  • a control to check that the maximum age is filled in
  • a control to check that the minimum age is less than the maximum age
  • a validation summary to list error messages found

Add a second set of validation controls as follows:

  • a control to check that the star sign is filled in
  • a validation summary to list any error messages found

Use validation groups to make sure that each set of validation occurs independently (you'll need to assign validation groups to the clickable buttons, and to the validation summaries too).

Your final form should look like this if you specify incompatible minimum and maximum ages:

ASP.NET 4.0 - C# exercise - Validation controls (image 1)

Even though the star sign isn't filled in, this part of the form isn't validated when you click on the CHOOSE BY AGE button

Test that your form works, then close the website down.

This page has 0 threads Add post