narasiman rao

narasiman rao

  • NA
  • 519
  • 767k

Validation for Date of Birth and Wedding Date

Dec 27 2012 4:31 AM

Date of Birth  textbox1(Calendar Image)

Wedding date textbox2(Calendar Image)

Insert( Button)


when i run and click the insert button i want to show the message "Date of birth or wedding date is not selected";.

for that i write the validation Code has follows;

 if (DOB.SelectedDateValue.ToString() == " " && Wedding.SelectedDateValue.ToString() == " ")
             {
                 LblErr.Text =  "Date of birth or wedding date is not selected";
                 return;
             }

suppose user did not select the date of birth and select the wedding date and click the insert button.

the message does not shows. Date of birth or wedding date is not selected".

it  is inserted  the record.

from my above validation code what is the problem

please correct my code.



Answers (1)