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

How to implement the date selection range event after the user has finished the selection?

3 Answers 66 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Edielton
Top achievements
Rank 1
Edielton asked on 26 Oct 2011, 12:58 PM
Hello telerik team!


We implemented the RadCalendar control in our application and we are stuck in an issue regarding the calendar range selection. We want the user to select the range of dates and once he selected the range we needed to trigger an event to process the information within that range. The problem is that none of the events from the contorols list seems to achieve this goal. We tried to implement the SelectionChanged, but even before the user finished selecting the range the event fired...

Which event would you suggest us to use? Could you provide an example?

Best regards,
Edielton
SistemaPri

3 Answers, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 31 Oct 2011, 02:36 PM
Hello Edielton,

When using Extended SelectionMode you can select dates either by dragging, using Shift or Control keys. There is no way for us to know when the selection is finished as you can always add another date with Control or Shift, so that is why there is no event that suits your needs. You have two choices.

1. Use the KeyDown event and check for a specific key press(Enter for example) that will confirm the selection and in this event you will handle the selected dates.

2. Change the way your application works so it can use the SelectionChanged event and its parameters like AddedItems and RemovedItems.

Hope this helps. Let us know if you have further questions.

Best wishes,
Boyan
the Telerik team

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

0
Edielton
Top achievements
Rank 1
answered on 31 Oct 2011, 02:56 PM

Hello Boyan, thanks for your reply!

 

From the solutions you suggested, the one who would fit to our needs would be the KeyDown event. The problem with the second solution is that we don't know when the selection changed, something you informed in the response below, what would make countless calls to our async service for every date selected. The KeyDown event is a good candidate, but we figured out that it just works when we click off the object's 'surface'. If you guys make it fire the event once the KeyDown is pressed over the date, that would be the way to go.

Any possibilities for that?

Once again, thanks for your comprehension.

Edielton
SistemaPri

 



0
Boyan
Telerik team
answered on 03 Nov 2011, 05:24 PM
Hello Edielton,

I am not sure that I understand what you are trying to achieve. What do you mean by "click off the object's surface " ? The solution that I had in mind is
private void calendar1_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                var a = calendar1.SelectedDates;
                //do sth with SelectedDates  collection
            }
        }
So the sequence is the following, select dates in the RadCalendar either by dragging or using CTRL or Shift button, then press Enter to confirm the selection. The event of course will be invoked only if the control is on focus when the Enter key is pressed.


Kind regards,
Boyan
the Telerik team

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

Tags
Calendar
Asked by
Edielton
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Edielton
Top achievements
Rank 1
Share this question
or