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

Choose a range (start and end dates)

1 Answer 477 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 25 Nov 2015, 08:56 AM

Hello.

I am experiencing a problem with RadDatePicker

In my application, the user chooses Start date and End date and according to that, the grid is updated.

I would like to avoid using Refresh button, i.e. letting the user pick both dates and then click refresh to get the data.

On the other hand, I don't want to update the data each time one of the Pickers is changed, before the second one is also picked.

I would like to do it this way: when user picks one of the dates, the second DatePicker expands for him so he can immediately choose a second date, and no need to click a refresh button. What happens is that DatePicker.IsDropDownOpen property seems not working from code behind.

In DatePicker1 SelectionChanged event handler, I am doing DatePicker2.IsDropDownOpen=true, but this doesn't work. The DatePicker2 stays closed.

 

Maybe there is another control, like doubleDatePicker which makes it possible to choose a range of dates? Like in CheckIn-Checkout pages on the internet, the datepicker control consists of 2 calendars.

 

Thanks in advance for your help.

Alexander

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 26 Nov 2015, 03:55 PM
Hello Alexander,

In order to open the second RadDatePicker as expected from the SelectionChanged event of the first one you need to set the IsDropDownOpen property inside a Dispatcher as shown below:
private void dateTimePicker1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    Dispatcher.BeginInvoke(new Action(() =>
    {
        this.dateTimePicker2.IsDropDownOpen = true;
    }));
}

Hope this helps.

Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
DatePicker
Asked by
Alexander
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or