need to show empty date

5 posts, 0 answers
  1. rob mays
    rob mays avatar
    58 posts
    Member since:
    Jun 2007

    Posted 30 Jun 2008 Link to this post

    When the datetimepicker loads I dont want any dates to be shown in the textbox please.

    how do i do that?
  2. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 02 Jul 2008 Link to this post

    Hello rob mays,

    RadDateTimePicker
    has NullDate support. When you set its Value to its NullDate (NullDate by default is equal to the MinDate), the text you will see in RadDateTimePicker would be set to the NullText. NullText by default is an empty string.
    • In order to set the NullDate to a different date than the MinDate, you should set the NullDate of the DateTimePickerElement:
      this.radDateTimePicker1.DateTimePickerElement.NullDate = DateTime.Now; 
    • In order to set the value to NullDate, call the SetToNullValue method:
      this.radDateTimePicker1.DateTimePickerElement.SetToNullValue(); 

    If you have additional questions, feel free to contact me.

    Regards,

    Nikolay
    the Telerik team


    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
  4. rob mays
    rob mays avatar
    58 posts
    Member since:
    Jun 2007

    Posted 03 Jul 2008 Link to this post

    many thanks for the response sorted it out for me. Well Done
  5. Ed Molieri
    Ed Molieri avatar
    3 posts
    Member since:
    Sep 2009

    Posted 11 Oct 2011 Link to this post

    Hello,  I'm having the following issue:

    When I trap the delete key on KeyDown I set DateTimePickerElement.SetToNullValue();  As expected the control's value disappears and the text box becomes blank.  The issue is that as soon as the control loses focus the old value re-displays. 

    Please help. 
  6. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 13 Oct 2011 Link to this post

    Hi Eduardo Molieri,

    I suppose that you are using Q3 2010 version.

    In this case you should simply call SetToNullValue method and handle the event.
    void radDateTimePicker1_KeyPress(object sender, KeyPressEventArgs e)
    {
      if (e.KeyChar == 'd')
      {               this.radDateTimePicker1.DateTimePickerElement.SetToNullValue();
     e.Handled = true;
      }
    }

    Please refer to the attached project.

    I hope this helps.

    Best wishes,
    Peter
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

Back to Top
UI for WinForms is Visual Studio 2017 Ready