1 / 11

Lesson 12

Lesson 12. Adding Validation To The Movie Database. 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. Adding A Hyperlink To Your Page.

sine
Download Presentation

Lesson 12

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 • 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: • <body> • <body text="#ffffff" bgcolor="#000000"> • 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 doesn’t 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

More Related