Possible to get SelectedView BEFORE TimeSlotCreated event?

2 posts, 0 answers
  1. Steve
    Steve avatar
    84 posts
    Member since:
    Aug 2013

    Posted 27 Nov 2013 Link to this post

    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.
  2. Plamen
    Plamen avatar
    2816 posts

    Posted 29 Nov 2013 Link to this post

    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.

    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.
Back to Top