Exercise: User controls to enter film name

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 Wise Owl course listed below!

Category ==> ASP.NET webforms - VB  (27 exercises)
Topic ==> User controls  (1 exercise)
Level ==> Average difficulty
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. 

Browse to the webpage called frmFilmEntry to see what it does - your task is to split this into 3 user controls called:

  • ucForm - the data entry form and Continue button
  • ucError - the error message HTML
  • ucAnswer - the answer to be displayed

Here's what your frmFilmEntry page should look like in source view when you've finished:

ASP.NET 4.0 - Visual Basic exercise - User controls (image 1)

The form is now simple - all of the complexity is in the user controls

When you browser to your form, you should see either an error or an answer, depending on whether you filled in a film name:

ASP.NET 4.0 - Visual Basic exercise - User controls (image 2)

One of either the ucError and ucAnswer user controls will appear

As one further clue, here are the events in the ucForm user control:

ASP.NET 4.0 - Visual Basic exercise - User controls (image 3)

Examples of the events that you could create in the form user control

Thought for when you've finished: was it worth it?  (For this case perhaps not, but in general almost certainly yes).

This page has 0 threads Add post