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

Possible to get SelectedView BEFORE TimeSlotCreated event?

1 Answer 8 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 27 Nov 2013, 06:52 PM
I'm trying to populate a dictionary class with opening and closing times, by date for the scheduler. This will allow me to enable and disable timeslots for specific dates. I have the logic working where it will enable and disable timeslots correctly, but the timing is off in creating the dictionary entries. I first attempted to populate the dictionary class in the page_init event, but the SelectedView of the scheduler is DayView everytime the page_init kicks off. So, I looked at the NavigationCommand event of the scheduler, but that gets kicked off AFTER the TimeSlotCreated event. I can't put the dictionary class creation into the TimeSlotCreated event, because that gets kicked off for every timeslot that gets shown.

What scheduler event is available BEFORE the TimeSlotCreated event, that has the SelectedView that is going to be shown?

In other words, the first time the page is loaded I start with SelectedView=DayView. Then I click on the Week link. Before the TimeSlotCreated event fires, I need to know where I can put my logic to populate the dictionary class where the SelectedView=WeekView. I need the SelectedView to show what the user selected, not what they had before the new selection.

I'm doing this in the Code-behind.

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 29 Nov 2013, 10:57 AM
Hello Steve,

In cases when navigation is used in RadScheduler TimeSlotCreated event is thrown two times for each slot and when you want to customize the timeslots you only need the second throw of this event. Between these events NavigationComplete is thrown. You can use it and populate your dictionary as in the code below:
Copy Code
public bool temporaryValue;
   public DateTime visibleStart;
   public DateTime visibleEnd;
 
   protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
   {
       if (temporaryValue)
       {
         //  populate your dictionary
           Response.Write(visibleStart + "-" + visibleEnd);
       }
   }
   protected void RadScheduler1_NavigationComplete(object sender, SchedulerNavigationCompleteEventArgs e)
   {
       temporaryValue = true;
       visibleStart = RadScheduler1.VisibleRangeStart;
       visibleEnd = RadScheduler1.VisibleRangeEnd;
 
   }

Hope this information will be helpful.


Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Scheduler
Asked by
Steve
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or