Hi, I'm trying to validate a date entered into text boxes like so using a custom validator:
string CombinedDate = String.Format("{0}-{1}-{2}", txtDay.Text, txtMonth.Text, txtYear.Text);
if (DateTime.TryParseExact(CombinedDate, "dd-MM-YYYY", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None, out date))
{
args.IsValid = true;
}
else
{
args.IsValid = false;
}
but it fails for 21-02-2005 why is that? and how can i fix it