Adding Validation To The Movie Database - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Adding Validation To The Movie Database

Description:

Lesson 12. Adding Validation To The Movie Database. Show All Data ... and place aside of Enter Movie Name ... Go to ErrorMessage and type Enter Movie Name ... – PowerPoint PPT presentation

Number of Views:104
Avg rating:3.0/5.0
Slides: 12
Provided by: briangs
Category:

less

Transcript and Presenter's Notes

Title: Adding Validation To The Movie Database


1
Lesson 12
  • Adding Validation To The Movie Database

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

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

4
Adding color to your page
  • Go to HTML view
  • Copy this code to add a background color and give
    your text color
  • 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
  • These are called Validator Controls
  • There are several to choose from

6
Validator Controls
  • RequiredField Validator- used to check to make
    sure your user doesnt leave a field blank
  • 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

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

8
Validating Your Record Input
  • Open the AddRecords.aspx file
  • 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 ErrorMessage and type Enter Movie Name
  • 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
  • Go to the properties of the RequiredFieldValidator
    and scroll down to ControlToValidate and type
    TextBox2
  • Go to ErrorMessage and type Enter Actor Name

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

11
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com