Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lesson 12 Adding Validation To The Movie Database.

Similar presentations


Presentation on theme: "Lesson 12 Adding Validation To The Movie Database."— Presentation transcript:

1 Lesson 12 Adding Validation To The Movie Database

2 Show All Data Create a new ASP.Net File and call it ShowAllData Create a new ASP.Net File and call it ShowAllData Go to data and drag the JamesBondSeries Table to the workspace Go to data and drag the JamesBondSeries Table to the workspace Save the File Save the File Press F5 to view and then close Press F5 to view and then close

3 Adding A Hyperlink To Your Page File Open the AddRecord.aspx file File Open the AddRecord.aspx file Drag a Hyperlink and place it to the right of the Button Drag a Hyperlink and place it to the right of the Button In the Hyperlink Properties, go to Navigate Url and type ShowAllData.aspx In the Hyperlink Properties, go to Navigate Url and type ShowAllData.aspx Go to Text and type View Data Go to Text and type View Data Press F5 to view and click on View Data Press F5 to view and click on View Data

4 Adding color to your page Go to HTML view Go to HTML view Copy this code to add a background color and give your text color: Copy this code to add a background color and give your text color: Press F5 to view Press F5 to view

5 Validating Your Data Web Matrix has some great features to make sure that users are going to enter the correct data into your database Web Matrix has some great features to make sure that users are going to enter the correct data into your database These are called Validator Controls These are called Validator Controls There are several to choose from There are several to choose from

6 Validator Controls RequiredField Validator- used to check to make sure your user doesn’t leave a field blank RequiredField Validator- used to check to make sure your user doesn’t leave a field blank RegularExpressionValidator- best used to check for correct e-mail addresses, internet url, phone numbers and zip codes RegularExpressionValidator- best used to check for correct e-mail addresses, internet url, phone numbers and zip codes RangeValidatgor- best used with dates and dates where you can select a minimum and maximum RangeValidatgor- best used with dates and dates where you can select a minimum and maximum

7 More Validator Controls CompareValidator- this allows you to compare a value with an operator like =,>,,< CustomValidator- this control can compare what the user is entering with the type of fields that you have in your database CustomValidator- this control can compare what the user is entering with the type of fields that you have in your database

8 Validating Your Record Input Open the AddRecords.aspx file Open the AddRecords.aspx file Drag a RequiredFieldValidator and place aside of Enter Movie Name Drag a RequiredFieldValidator and place aside of Enter Movie Name Go to the properties of the RequiredFieldValidator and scroll down to ControlToValidate and type TextBox1 Go to the properties of the RequiredFieldValidator and scroll down to ControlToValidate and type TextBox1 Go to ErrorMessage and type Enter Movie Name Go to ErrorMessage and type Enter Movie Name Press F5 and click the button to view how the RequiredField Validator works Press F5 and click the button to view how the RequiredField Validator works

9 Add More Validators Drag a RequiredFieldValidator and place aside of Enter Actor Name Drag a RequiredFieldValidator and place aside of Enter Actor Name Go to the properties of the RequiredFieldValidator and scroll down to ControlToValidate and type TextBox2 Go to the properties of the RequiredFieldValidator and scroll down to ControlToValidate and type TextBox2 Go to ErrorMessage and type Enter Actor Name Go to ErrorMessage and type Enter Actor Name

10 More Validators Repeat these instructions for the Actress and Director Fields Repeat these instructions for the Actress and Director Fields Press F5 to view and click the button Press F5 to view and click the button

11


Download ppt "Lesson 12 Adding Validation To The Movie Database."

Similar presentations


Ads by Google