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

Stop the selection of a day in month view

2 Answers 69 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 25 Apr 2012, 01:10 PM
Hello Telerik team,
is it possible to stop the selection of a day in month view?
I'm using the Scheduler control and I'm using the OnClientTimeSlotClick property to overwrite the behaviour of the scheduler control when a day in the month view is clicked (I'm generating an own ajax request, save the selected day in the session variable and use an own css class to change the background of this day in the month view).
This works fine.

Furthermore I have supressed the default behaviour if the day in the date header is clicked, so the scheduler will not change to the day view with the selected day.
This works fine also.

But one problem is still there. If the date header of a day in month view is now clicked (NOT the day number and NOT one of the other <tr> which are used to render the day in the month view), then the hole day will have assigned the 'rsSelected' css class (and in my example a deep blue background will be use), BUT the OnClientTimeSlotClick event WILL NOT FIRE. That means my own javascript function will not be called AND the new selected day will not be saved in the session variable.

Is there a way to prevent this? I mean to fire the right event so my own java function for the OnClientTimeSlotClick event will be called?

Greetings,
Richard Huber.

2 Answers, 1 is accepted

Sort by
0
Accepted
Plamen
Telerik team
answered on 30 Apr 2012, 09:55 AM
Hi Richard,

 
You can find the selected time slot before suppressing the default behavior of the click event and perform your custom implementation as you do in OnClientTimeSlotClick event:

function pageLoad() {
           var scheduler = $find("<%= RadScheduler1.ClientID %>");
           if (scheduler.get_selectedView() == Telerik.Web.UI.SchedulerViewType.MonthView) {
 
               $(".rsDateHeader").each(function() {
                   $(this).click(doNothing).dblclick(doNothing);
               });
           }
       }
        function doNothing(e) {
           getSelectedTimeSlot();
 
           if (!e) e = window.event;
 
           e.cancelBubble = true;
           if (e.stopPropagation) {
               e.stopPropagation();
           }
       }
 
       function getSelectedTimeSlot() {
           var scheduler = $find("<%= RadScheduler1.ClientID %>");
           var slots = scheduler.get_selectedSlots();
           alert(slots[0].get_startTime());
       }

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
Richard
Top achievements
Rank 1
answered on 30 Apr 2012, 11:52 AM
Hello Plamen,
thanks a lot, this solved my problem. I used your onPage method and combined it with an own method (a similar method as if the time slot is clicked) and it worked fine.

Greetings,
Richard Huber.
Tags
Scheduler
Asked by
Richard
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Richard
Top achievements
Rank 1
Share this question
or