Asp.Net validation controls

/
0 Comments

ASP.NET validation controls are used validate the user's inputs and store required data only.

The validation controls are available in asp.net

  • RequiredField Validator
  • Range Validator
  • Compare Validator
  • RegularExpression Validator
  • Custom Validator
  • ValidationSummary

RequiredField Validator

RequiredField Validator for TextBox

RequiredField Validator for DropDownList

This control used to ensures that the required field is not empty.The ControlToValidate needs to set which control need validate and ErrorMessage property is used to which message need to show when validation fails. InitialValue used for dropdownlist to set initial value i.e. select

Range Validator

This control verifies that the input value falls within a given range..it is used to validate the particular range values.it will work based on MinimumValue,MaximumValue and Type

Compare Validator

This control compares a value in one control with a fixed value or a value in another control..it is used to compare the values.it will work based on Operator,ValueToCompare,MaximumValue and Type

RegularExpression Validator

This control validating the input text by matching against a pattern of a regular expression.The regular expression is set in the ValidationExpression property.

ValidationSummary

This control can not perform any validation but shows a summary of all errors in the page. The summary displays the values of the ErrorMessage property of all validation controls that failed validation.it is used to compare the values.it will work based on Operator,ValueToCompare,MaximumValue and Type

Validation Group

if pages have different groups of information provided in different sections/panels,need to us validationgroup.This kind of situation is handled using validation groups.To create a validation group, you should put the input controls and the validation controls into the same logical group by setting their ValidationGroup property.

Validations Example

This example shows after clicked the submit button.All validators are used and it is showing errors



You may also like

No comments:

Powered by Blogger.