date of birth validation

narasiman rao

narasiman rao

Dec 26 2012 5:00 AM
i have one field in design page as follows;
Date of Birth textbox1(calendar image)
i want to validate date of birth date should be greater than the todays date and more than the todays date.
for that i write the code as follows;
DateTime DOB = Convert.ToDateTime(FromDate.ToString());
if(FromDate.SelectedDateValue > DateTime.Now)
Label6.Text = ("you have not born yet");

i try the above code when i run i show the error message as follows;
Operator '>' cannot be applied to operands of type 'string' and 'System.DateTime.

for my above code please correct my code and reply.

thanks,please help me.

Answers (1)