Page Rank

Subscribe

Categories

Recent posts

Alexa Rank

ASP.NET Validation Controls


  • ASP.NET Validation Controls is used to validate the data of an input device. If the data in the input device does not pass, it will show an error message to the user.
  • Syntax for creating Validation server controls:

  • The list of ASP.NET Validation controls are,

RequiredFieldValidator

RangeValidator

RegularExpressionValidator

CompareValidator

CustomValidator

ValidationSummary

RequiredFieldValidatorASP.NET Validation Controls

  • The RequiredFieldValidator ensures that the user cannot skip an entry. ie, The RequiredFieldValidator is used to make an input control is a required field.
  • Note: Leading and trailing spaces of the input value are removed before validation.

Main Properties to set for RequiredFieldValidator:

ControlToValidate – here you have to set which control is needed validation.
Enabled – A Boolean value that specifies whether the validation control is enabled or not
Text – The message to display when validation fails.

RangeValidator – ASP.NET Validation Controls

  • The RangeValidator control is used to check that the user enters an input value that falls between two values. It is possible to check ranges within numbers, dates, and characters.
  • Note: The validation will not fail if the input control is empty. Use the RequiredFieldValidator control to make the field required.

Main Properties to set for RangeValidator:

ControlToValidate – here you have to set which control is needed validation.
Enabled – A Boolean value that specifies whether the validation control is enabled or not
MaximumValue – Specifies the maximum value of the input control
MinimumValue – Specifies the minimum value of the input control
Type – Specifies the data type of the value to check. They are;  Currency, date, double, integer, string.
Text – The message to display when validation fails.

RegularExpressionValidator - ASP.NET Validation Controls

  • The RegularExpressionValidator is used to make sure that the input control matches the specified expression that you are given.
  • Note: Both server- and client-side validation are performed unless the browser does not support client-side validation or the EnableClientScript property is set to false.

Main Properties to set for RegularExpressionValidator:

ControlToValidate – here you have to set which control is needed validation.
Enabled – A Boolean value that specifies whether the validation control is enabled or not
ValidationExpression – Specifies the expression used to validate input control. The expression validation syntax is different on the client than on the server.
Text – The message to display when validation fails.

CompareValidatorASP.NET Validation Controls

  • The CompareValidator control is used to compare the value of one input control to the value of another input control or to a fixed value.

Main Properties to set for CompareValidator:

ControlToCompare – The name of the control to compare
ControlToValidate – The id of the control to validate
Text – The message to display when validation fails.
ValueToCompare – A specified value to compare

CustomValidatorASP.NET Validation Controls

  • The CustomValidator control allows you to write a method to handle the validation of the value entered.

ControlToValidate – The id of the control to validate
Text – The message to display when validation fails.

ValidationSummaryASP.NET Validation Controls

  • The ValidationSummary control is used to display a summary of all validation errors occurred in a Web page.

validation control

ASP.NET Validation Controls


VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">