When re-selecting the already selected date, the datepicker textbox gets emtpy

2 posts, 0 answers
  1. Daniel Grünberger
    Daniel Grünberger avatar
    46 posts
    Member since:
    May 2008

    Posted 10 Jul 2009 Link to this post

    Hi,
    When re-selecting the already selected date, the datepicker textbox gets emtpy.
    As a workaround, I manually set the selecteddate in this case:

     

    private void DatePicker_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)

    {

     

      if (this.DatePicker.SelectedDate == null && ((System.DateTime)(((object[])(e.RemovedItems))[0])).Date != null)

     

     

      {

     

        this.DatePicker.SelectedDate = ((System.DateTime)(((object[])(e.RemovedItems))[0])).Date;

     

     

      }

    }

    Is there a better solution for this?
    br,
    Markus

     

     

  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 10 Jul 2009 Link to this post

    Hi Markus,

    This behavior is intended, but not very intuitive in my opinion. It was made to allow the user to unselect the currently selected date, e.g. to provide Null (no selection) value. I am afraid that I cannot provide better solution at this moment. We are working on a new versions of RadCalendar/RadDatePicker that will enable the developers to specify the selection mode of the control, e.g. whether the user will be able to deselect a date with a second click, or not.

    All the best,
    Valeri Hristov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
Back to Top