1
Answer

Validation for Date of Birth and Wedding Date

Ask a question

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)