What are the types of Validation Controls in ASP.NET?

Validation controls check user input in SelectionList and TextBox controls. Validation occurs when the form is posted to the server. The validation controls test the user's input and, if the input fails any of the validation tests, ASP.NET sends the page back to the client device. When this occurs, the validation controls that detected errors display error messages.

With the exception of the ValidationSummary control, all validation controls must reference a SelectionList or TextBox control. Store the reference in the validation control's ControlToValidate property. Because the ValidationSummary control does not reference other controls, it does not contain a ControlToValidate property.

Validation controls include five controls that make comparisons and one control that summarizes any errors that occur. All validation controls must be placed within a Form or Panel control, or inside a control's template on a mobile Web page. You can also drag a validation control onto a mobile user control page.

The following table lists the validation controls and links to topics describing the validation tasks they perform.


CompareValidator

CustomValidator

RangeValidator

RegularExpressionValidator

RequiredFieldValidator

ValidationSummary

No comments: