TimeSlotCreated

The TimeSlotCreated event occurs when a time slot is created. TimeSlotCreated has two parameters:

  • sender is the scheduler control.

  • e is an object of type TimeSlotCreatedEventArgs. It has the TimeSlot property.

The TimeSlotCreated event is not fired after the advanced edit form is opened (it fires before that, and rendering the advanced form renders the scheduler anew). Thus, customizations for the time slots made in the handler are not rendered while the advanced edit form is visible.

Example

The code sample below sets a "Disabled" css style for time slots which have one or more appointments:


protected void RadScheduler1_TimeSlotCreated(object sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e)
{
    if (e.TimeSlot.Appointments.Count > 0)
    {
        e.TimeSlot.CssClass = "Disabled";
    }
}  


Protected Sub RadScheduler1_TimeSlotCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.TimeSlotCreatedEventArgs)
    If e.TimeSlot.Appointments.Count > 0 Then
        e.TimeSlot.CssClass = "Disabled"
    End If
End Sub

When customizing a Timeslot based on the start time hours, the start time should be converted to the Timezone of the Scheduler, if it is set.

Example


protected void RadScheduler1_TimeSlotCreated(object sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e)
{
        RadScheduler scheduler = sender as RadScheduler;
        DateTime startdate = e.TimeSlot.Start.Add(scheduler.TimeZoneOffset);
        if (startdate.Hour == 8)
        {
            e.TimeSlot.CssClass += "Disabled";
        }
}  


Protected Sub RadScheduler1_TimeSlotCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.TimeSlotCreatedEventArgs)
    Dim scheduler As RadScheduler = DirectCast(sender, RadScheduler)
    Dim startdate = e.TimeSlot.Start.Add(scheduler.TimeZoneOffset)

    If startdate.Hour = 8 Then
        e.TimeSlot.CssClass += "Disabled"
    End If
End Sub

See Also

In this article
Not finding the help you need? Improve this article