This is a migrated thread and some comments may be shown as answers.

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

1 Answer 37 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Daniel Knoll
Top achievements
Rank 1
Daniel Knoll asked on 10 Jul 2009, 09:14 AM
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

 

 

1 Answer, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 10 Jul 2009, 12:13 PM
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.
Tags
Calendar
Asked by
Daniel Knoll
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Share this question
or