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

Scheduling appoinments during time box/slot

1 Answer 15 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 07 Nov 2013, 11:11 PM
  Is there an easy way to define a time box for a set of days within which appointment may be scheduled?  For example, I would like to define Mondays and Wednesday between 9AM and 5PM as a region which appointments can be made.  I would like it to be visually obvious (I think this can be done with SpecialDays and the handler for slot created if nothing else.

1 Answer, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 11 Nov 2013, 03:31 PM
Hi Alex,

Try to handle OnTimeSlotCreated event and set a css class for the time you don't want to schedule appointments:
<style type="text/css">
    .Disabled {
        background: silver !important;
        cursor: not-allowed;
    }
</style>

protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
{
    if (e.TimeSlot.Start.Hour < 9 ||  e.TimeSlot.Start.Hour > 17)
    {
        e.TimeSlot.CssClass = "Disabled";
    }
}

Finally cancel appointment inserting if is clicked on a time slot, that is out of the defined time span:
function OnClientAppointmentInserting(sender, eventArgs) {
    var slotElement = $telerik.$(eventArgs.get_targetSlot().get_domElement());
    if (slotElement.is(".Disabled") || slotElement.parent().is(".Disabled") || slotElement.is(".rsOtherMonth") || slotElement.parent().is(".rsOtherMonth")
    || slotElement.is(".rsNonWorkHour") || slotElement.parent().is(".rsNonWorkHour")) {
        // Prevent appointment inserting on holidays.
        eventArgs.set_cancel(true);
    }
}

There is an online demo, which actually shows the same functionality.

Regards,
Hristo Valyavicharski
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
Alex
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Share this question
or