Validating date with rangevalidator control in not girlfriend but dating

In this article, you will learn about the support that ASP.NET provides to you for performing data validation. While using this site, you agree to have read and accepted our terms of use and privacy policy.

We can check datatype using the Compare Validator control.

Many a times, we need to check whether a user has enetered a date in a date filed, string in a string field, and a number in number field.

You can check ranges within pairs of numbers, alphabetic characters, and dates. The Range Validator is used to validate if the given data is in the specified range or not. NET Ajax toolkit has a Calendar Extender control which is very cool as you can associate the Calendar Extender to a Text Box and also to a Button.

Drag the Calendar Extender Control from the Ajax Control Toolkit so that you can popup the Calendar.

A common example we come across is comparing the Passwords while registering a new user.

Another common example is while generating reports when user enters start date and end date, we need to check whether end date is always equal to or greater than the start date.This control can be used to check dates, numbers, currency amounts and strings.The commonly used properties of Range Validator control are: Type: We specify the data type to use when comparing values Text: We specify the Error message to be displayed by the control Control To Validate: We specify the ID of the control that we want to validate Maximum Value: We specify the maximum value in the range of values Minimum Value: We specify the minimum value in the range of values An alternative method to check whether a page is valid is shown below.You have to use this format also when using a custom validator.The code snippet below demonstrates how to configure Range Validator.Validating Data Often, bad data doesn't affect your organization until someone tries to report against it or some business intelligence project uncovers the presence of inconsistencies.

Tags: , ,