You can use javascript code for validating the Date in TextBox.
Write the following JavaScript code:-
function CalculateAge(birthday)
{
var re = /^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d+$/;
if (birthday.value != '')
{
if (re.test(birthday.value))
{
return true;
else
{
alert('Date must be mm/dd/yyyy format');
return false;
}
}
Now in TextBox onblur event call this JavaScript function:-
<asp:textbox id="txtAge" runat="server" onblur="CalculateAge(this)" />
For more Please Visit this link:-
Regular expression to validate date in mm/dd/yyyy format in JavaScript[
^]
Good luck.