Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Date time picker validations

I am sorry for posting this question as it may be find silly to all, but I am not getting the exact solution.

The question is: I have a Date time picker in my project, it comes after the 3 textboxes in the form, if there is no text is entered in the textbox and enter on submit, it gives a message(validation) that data to be entered. In the same way, if the date is not selected, it should proceed further.

What is the code to do that, the code which worked for other textboxes and not working for datetimepicker control is:

       if (dateInsert.Value.ToString() = string.Empty)
        {
            MessageBox.Show("Please select date!");
            dateInsert.Focus();
            return;
        }
like image 740
karthik reddy Avatar asked Sep 11 '13 10:09

karthik reddy


1 Answers

Please correct the code and see if it works

               if (dateInsert.Value.ToString() == "")
              {
                MessageBox.Show("Please select date!");
                dateInsert.Focus();
                return;
               }
like image 63
user2749421 Avatar answered Sep 29 '22 03:09

user2749421