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

How to get TimeSlot's CssClass in OnClientTimeSlotClick event

8 Answers 96 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Mohsin
Top achievements
Rank 1
Mohsin asked on 12 Apr 2011, 01:20 PM
Hi Telerik Team,

I am having problem. I have radSchedular that is populating from database. I wrote TimeSlotCreated server side event in which I set the disabled/enabled class based on my required condition (e.TimeSlot.CssClass = "Disabled";)

In my ASPX page i wrote 

function OnClientTimeSlotClick(sender, eventArgs)
{
        var now = new Date();
if (sender.get_selectedView() == Telerik.Web.UI.SchedulerViewType.WeekView) {
            if (eventArgs.get_time() < now) {
                alert("Time slot not available");
            }
        }
}

this event simply shows alert if the tiemslot time is less than current time.
I need to get the CssClass and check if CssClass is "disabled" or "enabled". So that I can show alert('Time slot not available') if the CssClass is 'disabled'.

Prompt response is highly appreciated. 

Regards,
Mohsin

8 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 18 Apr 2011, 09:13 AM
Hello Mohsin,

Here is one possible solution:
<script type="text/javascript">
       function OnClientTimeSlotClick(sender, args) {
           var timeSlotClassName =  args.get_targetSlot().get_domElement().className;
           alert(timeSlotClassName.match("Disabled"));
           //match() will return null if no such string is found
       }
   </script>


Greetings,
Peter
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Mohsin
Top achievements
Rank 1
answered on 21 Apr 2011, 12:00 PM
Hi Peter,

Thanks for the help, it really works for me.
But when I place this code under OnClientAppointmentMoveEnd event this will not giving me desired result.
It is showing the Class of moved appointment. I want the classname of the target slot where the appointment has been moved.
Further more i want the same scenario on OnClientAppointmentResizeEnd event.

please tell me how to do this.

Regards,
Mohsin
0
Peter
Telerik team
answered on 22 Apr 2011, 04:52 PM
Hello Mohsin,

When handling OnClientAppointmentResizeEnd and OnClientAppointmentMoveEnd you can use the get_targetSlot() method.


Kind regards,
Peter
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Mohsin
Top achievements
Rank 1
answered on 23 Apr 2011, 10:33 AM
Hi Peter,

I have placed following code in OnClientAppointmentResizeEnd and OnClientAppointmentMoveEnd event

var slotElement = $telerik.$(eventArgs.get_targetSlot().get_domElement());
if (slotElement.is(".Disabled") || slotElement.parent().is(".Disabled")) {
         eventArgs.set_cancel(true);
}

OnClientAppointmentResizeEnd work fine with above code but OnClientAppointmentMoveEnd does not. It is not getting targetSlot css, it is getting the currently selected appointment's class.

Please suggest what do I do, is there other way to do that???

Regards,
Mohsin
0
Peter
Telerik team
answered on 28 Apr 2011, 03:58 PM
Hi Mohsin,

This might be a bug with RadScheduler. We will examine it closer and follow up if we succeed in finding a workaround.

All the best,
Peter
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Frank
Top achievements
Rank 1
answered on 01 Jun 2011, 01:24 PM
Any news on this one?

This must be a bug, I also get the CssClass of the Appointment instead of the Timeslot in the OnClientAppointmentMoveEnd clientevent.
0
Peter
Telerik team
answered on 02 Jun 2011, 10:06 AM
Hello Frank,

I am glad to let you know that this bug has been recently fixed. Please, try with the latest internal build and let me know if all is fine.


All the best,
Peter
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Frank
Top achievements
Rank 1
answered on 07 Jun 2011, 09:19 AM
Hi Peter,

I can confirm it's now working, great job!!

Thanks,

Frank
Tags
Scheduler
Asked by
Mohsin
Top achievements
Rank 1
Answers by
Peter
Telerik team
Mohsin
Top achievements
Rank 1
Frank
Top achievements
Rank 1
Share this question
or