Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
490
CalendarCombo prevent (none)
posted

 I have CalendarCombo and the user can DropDown and select the date my Question is : how we can prevent user to clear calender(make it none) because I am using the following code in CalendarCombo1_AfterCloseUp event and it's give me input string error :

                DateTime enterDate = DateTime.Parse(CalendarCombo_From.Value.ToString());
                DateTime todayDate = DateTime.Parse(CalendarCombo_To.Value.ToString());


                int val_end = DateTime.Compare(todayDate, DateTime.Now);
                if (val_end != 1)//if Date To bigger than today date
                {
                    int val = DateTime.Compare(enterDate, todayDate);
                    if (val == 1)//if Date From bigger than Date To
                    {
                        CalendarCombo_From.Value = DateTime.Now;
                     
                    }
                }
                else
                {                
                    CalendarCombo_To.Value = DateTime.Now;
                }

Parents
No Data
Reply
  • 69832
    Offline posted

    I'm not certain that I followed this but you can set AllowNull to false to prevent the Value property from being nullified.

Children