Block arrow keys from scheduler?

1 Answer 86 Views
Scheduler and Reminder
Sean
Top achievements
Rank 1
Sean asked on 03 Jul 2022, 10:47 PM

Hello, how can I block the arrow keys from the Scheduler so that the user cannot change the month view's calendar?

I have blocked out and set all the days that is not within X month to be hidden, so I do not want the user to be able to use the arrow keys and accidentally change the view.

 

Also, related to the scheduler, how can I loop through and go through the entire month day-by-day to grab all the appointments?

Something like, for each day in MONTH....

 

Thank you

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 06 Jul 2022, 12:33 PM

Hello Sean,

Thank you for contacting us.

If you need to stop navigating when the user presses the left/right arrow keys of the keyboard, you can create a custom SchedulerInputBehavior and override its HandleNavigationKey method where you can stop the basic logic. Here is a sample code snippet: Feel free to modify it in a way that suits your requirement best: 

this.radScheduler1.SchedulerInputBehavior = new CustomSchedulerInputBehavior(this.radScheduler1);

public class CustomSchedulerInputBehavior : SchedulerInputBehavior
{
    public CustomSchedulerInputBehavior(RadScheduler scheduler) : base(scheduler)
    {
    }
 
    public override bool HandleNavigationKey(KeyEventArgs args)
    {
        if (args.KeyData == Keys.Left || args.KeyData == Keys.Right)
        {
            return true;
        }
        return base.HandleNavigationKey(args);
    }
}

Regarding your second question, you can use the Appointments collection of the control. You can iterate it or use a LINQ query to get all the appointments in a specific month.

I hope that you find this information helpful.

Regards,
Dinko
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Scheduler and Reminder
Asked by
Sean
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or