TimePicker - Null Value

2 posts, 0 answers
  1. Doug
    Doug avatar
    50 posts
    Member since:
    Jul 2012

    Posted 24 Sep 2013 Link to this post

    I'm storing a DateTime in XML to tell an applicaton when it will shut down.  I intend to use the value of "01/01/0001 00:00:00" to mean that we have no shut down scheduled.  On the form that will get and set this value I am using two controls, a DateTimePicker and a TimePicker, to work with the value.  (I'm open to other options.)

    You already taught me how to handle the DateTimePicker so I'm initializing that control like this:
    dtpShutDown.NullDate = Convert.ToDateTime("01/01/0001");
    dtpShutDown.NullText = "";
    dtpShutDown.Value = Convert.ToDateTime("01/01/0001");

    I'm not quite there with the equivalent for the time picker.  This gives me the "00:00 AM" text:
    tpLogin.NullText = "";
    tpLogin.Value = Convert.ToDateTime("01/01/0001 00:00:00");

    I would like some way to just blank out the whole value.

    I'm working with options while I wait for your response.  A single DateTimePicker with a custom format to include the time may work out better than I had initially thought.  (Regardless, I would like to know how to set the null time for the TimePicker.)

    Thank you,

  2. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    3957 posts

    Posted 27 Sep 2013 Link to this post

    Hello Gary,

    Thank you for contacting Telerik Support.

    RadTimePicker.Value's type is DateTime? and allows null as value. Thus, you can obtain an empty RadTimePicker:
    radTimePicker1.NullText = string.Empty;
    radTimePicker1.Value = null;

    I hope this information helps. Should you have further questions, I would be glad to help.

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top