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

Detect Navigation Command prior to TimeSlotCreated

9 Answers 113 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 07 Oct 2011, 07:06 PM
In month view I need to detect if the next month or previous month arrow has been clicked. No big deal right? I just do it in the OnNavigationCommand event of RadScheduler with something like:

if (e.Command == SchedulerNavigationCommand.NavigateToNextPeriod)

And that works fine. The issue is that I need to set a flag in this case before the TimeSlotCreated event fires. However, in some cases, (usually the first time I click on the next month arrow) the TimeSlotCreated event fires before the OnNavigationCommand event so my flag is not set and my code bombs.

Can anyone thing of a work around for me? Much appreciated!

Dan

9 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 12 Oct 2011, 09:03 AM
Hi Dan,

I inspected the issue but didn't notice anything unusual. At every single case the normal behavior is - first the TimeSlotCreated is thrown(for every single slot), after that the NavigationCommand and then another time the TimeSlotCreated so you should be careful how you reset your flag.

Hope this will be helpful

Regards,
Plamen Zdravkov
the Telerik team
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 their blog feed now
0
Dan
Top achievements
Rank 1
answered on 12 Oct 2011, 04:39 PM
No I still find it is inconsistent and that NavigationCommand does not always fire first. I realize that TimeSlotCreated fires for each time slot and have a way to deal with that but need to guarantee that NavigationCommand fires first before the first time slot which it doesn't always do.

Doesn't matter now though. I decided to set a hidden field on the client side with the OnClientNavigatioCommand function and this always fires before the other server side events. Thanks anyway.
0
Plamen
Telerik team
answered on 14 Oct 2011, 03:49 PM
Hello Dan,

I have inspected the throwing of the events once again in the common case but didn't observe any inconsistent behaviour. Would you be that kind to explain what is the scenario so that if there is an unsolved issue in the product, we could find it and log it for fixing.

Greetings, Plamen Zdravkov
the Telerik team
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 their blog feed now
0
Dan
Top achievements
Rank 1
answered on 14 Oct 2011, 04:04 PM
Not sure what more I can tell you. I have placed a break point on the first line of code in each of the two events:
RadScheduler1_NavigationCommand
RadScheduler1_TimeSlotCreated

When I click the next month arrow in month view, the first break is in TimeSlotCreated.

Dan
0
Plamen
Telerik team
answered on 19 Oct 2011, 04:49 PM
Hello Dan,

I am sending you a sample project that represents a scheduler with only two timeslots. It is showing how when a navigation arrow is clicked the TimeSlotCreated event is thrown two times - one before and once after the NavigationCommand event. This is the expected behavior of the RadScheduler.  

Hope that this will be useful.

Regards,
Plamen Zdravkov
the Telerik team
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 their blog feed now
0
Mangesh
Top achievements
Rank 1
answered on 09 Sep 2012, 08:59 PM
Hi,

My query is related to this thread of Radscheduler forum. 

If this is the expected behavior of the Radscheduler i.e., first TimeSlotCreated then NavigationCommand event and again TimeSlotCreated, It would cause performance issue to some extent. 

TimeSlot fires for every slot in the radscheduler and already take some time to check on each timeslot basis and in this behavior it runs twice one before and one after. and hence this can lead to performance issue.

Is there any other workaround i.e. to NavigationCommand event will fire first and then TimeSlotCreated.

Thanks,
Mangesh
0
Plamen
Telerik team
answered on 10 Sep 2012, 01:31 PM
Hello Mangesh,

 
Thank you for your opinion and suggestion. We have already been inspecting this possibility but unfortunately it can not be achieved because this functionality is critical for the over all behavior of RadScheduler. Please excuse us for this inconvenience. 

You can also think using WebService binding which is our best performance scenario where TimeSlotCreated 
 is thrown only in the beginning.

Hope this will explain the issue.

Regards,
Plamen
the Telerik team
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 their blog feed now.
0
Mangesh
Top achievements
Rank 1
answered on 27 Nov 2012, 12:16 PM
Hello Plamen,

Is there any other way than TimeSlotCreated event to disable the the timeslot. In my application there is a difference of 5 minutes in timeslots in Radscheduler. So checking for every 5 minutes timeslots is not a good idea and also rises performance issue. What I want is I have lets say time ,For Monday , 8:00 AM to 7:00 PM. Now I wanted to apply disable css to other slots. But without using TimeSlot created. Is there any event in which I can grab all the timeslots and then one by one, I'll check it gainst the data?

Thanks,
Mangesh
0
Plamen
Telerik team
answered on 29 Nov 2012, 09:37 AM
Hi Mangesh,

 
One possible way to achieve this issue is with javascript as it is done in the code below:

function pageLoad() {
               var $ = $telerik.$;
              var scheduler= $find('<%=RadScheduler1.ClientID%>');
               var now = new Date();
 
               $(".rsAllDayTable:visible td", scheduler.get_element()).each(function (i) {
 
                   var currentTimeSlot = scheduler.get_activeModel().getTimeSlotFromDomElement($(this).get(0));
 
                   $(this).css("background", " ");
 
                   if (currentTimeSlot.get_startTime() < now)
 
                       $(this).css("background", "silver");
 
               });
 
               $(".rsContentTable:visible td", scheduler.get_element()).each(function (i) {
 
                   var currentTimeSlot = scheduler.get_activeModel().getTimeSlotFromDomElement($(this).get(0));
 
                   $(this).css("background", " ");
 
                   if (currentTimeSlot.get_startTime() < now)
 
                       $(this).css("background", "silver");
 
               });
           }
           
           function OnClientAppointmentInserting(sendr,args) {
 
               if (args.get_targetSlot().get_domElement().style.background.indexOf("silver")!=-1) {
                   args.set_cancel(true);
               }
           }
 
           function OnClientAppointmentEditing(sender,args) {
               if (args.get_appointment().get_timeSlot().get_domElement().style.background.indexOf("silver") != -1) {
                   args.set_cancel(true);
               }
           }


Hope this will be helpful.

Greetings,
Plamen
the Telerik team
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 their blog feed now.
Tags
Scheduler
Asked by
Dan
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Dan
Top achievements
Rank 1
Mangesh
Top achievements
Rank 1
Share this question
or