Validating date in asp net

12 Feb

For example, you can use validation controls to prevent a user from submitting the value "Apple" for a birth date field.

However if you just needed to validate if the user clicked on a date in the calendar control you can just use the regular calendar control and a customvalidator like this.

The calendar control: Then I have a button to save the form back to the database. Is Valid = False Exit Sub End If End Sub C# protected void btn Caltest_Click(object sender, Event Args e) The cv Caltest.

The validation controls use client-side Java Script.

This is great from a user experience perspective because you get immediate feedback whenever you enter an invalid value into a form field.

You can use the validation controls with browsers that do not support Java Script (or do not have Java Script enabled).If a browser does not support Java Script, the form must be posted back to the server before a validation error message is displayed.