O'Reilly logo

Learning ASP.NET 2.0 with AJAX by Dan Hurwitz, Jesse Liberty, Brian MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5: Validation

Answers to Quiz Questions

  1. You need validation because users make mistakes. The wrong input could result in misplaced orders, inaccurate records, and can even corrupt your database. Validation gets the user to fix those errors before they get anywhere near your data.

  2. Set the button's CausesValidation property to false.

  3. The RequiredFieldValidator— in the case of a radio button list, you've already defined the choices for the user, so you don't need to validate the form or type of input; you just need to make sure that they chose something.

  4. When the Display property is set to Static, the validator takes up a fixed amount of room, even if it's not displaying a message. When it's set to Dynamic, the control is only rendered when there's a validation error, which can cause other controls to move around.

  5. Use a RequiredFieldValidator, and set the InitialValue property to "Choose a payment method."

  6. It enables you to place all the validation error messages in one spot on the page, instead of next to each control.

  7. Use a CompareValidator. You can compare the quantity the user ordered with the amount of inventory in your database, and make sure that the amount the user wants is equal to or less than the amount you have.

  8. Use a NoSnoreValidation control, to make sure none of the guests snore too loudly. Just kidding. Use a RangeValidator. Set the MinimumValue to 2, and the MaximumValue to 5.

  9. Use a RegularExpressionValidator. The Regular Expression Editor has an option that provides ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required