NullableDateTimePicker

6 posts, 0 answers
  1. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 01 Mar 2011 Link to this post

    Requirements

    RadControls version 2010.3 10.1215
    .NET version 3.5 SP1
    Visual Studio version 2008, 2010
    programming language CS, VB

    As of Q2 2011, this project is no longer supported since the RadDateTimePicker control support null value out of the box: http://www.telerik.com/products/winforms/whats-new/release-history/q2-2011-version-2011-2-11-712.aspx

    PROJECT DESCRIPTION
    In the last few months i have seen a lot of requests on the forums for a ( bindable ) nullable date time picker.
    This project is meant as an extension of the RadDateTimePicker and uses the internal checkbox to specify if the selected value is null or if a date is selected.



  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 02 Mar 2011 Link to this post

    Hello Emanuel,

    Thank you for providing this sample for a Nullable RadDateTimePicker, I believe that out community would benefit from it.
     
    All the best,
    Stefan
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 02 Mar 2011 Link to this post

    Hello Stefan,

    Could you please move this project to the Editors Code library page?
    That way it would be easier to find.

    Best Regards,
    Emanuel Varga
  4. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 02 Mar 2011 Link to this post

    Hi Emanuel,

    This code library article has just been moved to the appropriate section.

    All the best,
    Nikolay
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  5. hartley
    hartley avatar
    9 posts
    Member since:
    Nov 2009

    Posted 03 Aug 2011 Link to this post

    I have come up with a solution that works for me when binding a plain RadDateTimePicker to a .net Binding Source. My full post is here. 
    http://www.telerik.com/community/forums/winforms/calendar-and-datetimepicker/raddatepicker-and-null-values.aspx#1747985

    By modifying the default control set up:
    • A Null value is translated in and out without error. 
    • Today's date is given focus when the calendar opens 
    • The display text is blank when users press delete, or a null is in the data source

    I Set the DataBinding NullValue to Today 12:00:01 AM :

    this.radDateTimePicker1.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.tblClientBindingSource, "ClientSinceDate", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, System.DateTime.Now.Date.AddSeconds(1), ""));

    Then I set the DateTimePicker NullDate to Today 12:00:01 AM,  and Value to Today 12:00:00 AM. 

    this.radDateTimePicker1.NullDate = System.DateTime.Now.Date.AddSeconds(1);
    this.radDateTimePicker1.NullText = "";
    this.radDateTimePicker1.Value = System.DateTime.Now.Date;

  6. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 09 Aug 2011 Link to this post

    Hi Hartley,

    Thank you for sharing your solution with the community.

    I would like to inform you that in Q2 2011 we provided support for Null Value in RadDateTime/RadMaskedEditBox. So the following code should show an empty DateTimePicker:

    this.radDateTimePicker1.NullText = "";
    this.radDateTimePicker1.NullableValue = null;

    Best wishes,
    Peter
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Back to Top