I'm applying css classes to timeslots in the OnTimeSlotCreated event. I'm also only using the timeline view, and my scheduler is in an ajax panel and a radsplitter. When the scheduler initially loads, all the timeslots look blank (greyed out), but when I click the Timeline button on the top right, everything renders fine. Also, I found out that if I override the timeslot css and specify position: relative that it renders fine the first time, but is layed out on top of appointments. Here is my scheduler code and the code-behind that sets css classes. Any help would be greatly appreciated.
<
telerik:RadScheduler
runat
=
"server"
ID
=
"RadScheduler1"
TimelineView-NumberOfSlots
=
"7"
AdvancedForm-Enabled
=
"false"
OnClientAppointmentClick
=
"appointmentClick"
EnableExactTimeRendering
=
"false"
SelectedView
=
"TimelineView"
CustomAttributeNames
=
"SRID,PhaseID"
OnAppointmentContextMenuItemClicked
=
"RadScheduler1_AppointmentContextClick"
DataStartField
=
"StartDate"
DataEndField
=
"EndDate"
DataKeyField
=
"PhaseID"
DataSubjectField
=
"PhaseName"
DataSourceID
=
"PhasesDataSource"
AllowDelete
=
"false"
AllowEdit
=
"true"
AllowInsert
=
"false"
OnTimeSlotCreated
=
"RadScheduler1_TimeSlotCreated"
OverflowBehavior
=
"Scroll"
EnableAjaxSkinRendering
=
"true"
DayView-UserSelectable
=
"false"
WeekView-UserSelectable
=
"false"
MonthView-UserSelectable
=
"false"
GroupBy
=
"PhaseName"
GroupingDirection
=
"Vertical"
RowHeaderWidth
=
"150px"
>
<
AppointmentTemplate
>
<
b
><%# Eval("SRID") %></
b
>
</
AppointmentTemplate
>
<
AppointmentContextMenus
>
<
telerik:RadSchedulerContextMenu
runat
=
"server"
ID
=
"SchedulerAppointmentContextMenu"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Unschedule"
Value
=
"CommandEdit"
/>
</
Items
>
</
telerik:RadSchedulerContextMenu
>
</
AppointmentContextMenus
>
<
TimelineView
GroupingDirection
=
"Vertical"
NumberOfSlots
=
"7"
GroupBy
=
"PhaseName"
/>
<
ResourceHeaderTemplate
>
<
asp:Panel
runat
=
"server"
ID
=
"resoursePanel"
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text='<%# Eval("Text") %>'></
asp:Label
>
</
asp:Panel
>
</
ResourceHeaderTemplate
>
<
ResourceTypes
>
<
telerik:ResourceType
KeyField
=
"PhaseName"
Name
=
"PhaseName"
TextField
=
"PhaseName"
ForeignKeyField
=
"PhaseName"
DataSourceID
=
"AllPhases"
/>
</
ResourceTypes
>
</
telerik:RadScheduler
>
Random r =
new
Random();
protected
void
RadScheduler1_TimeSlotCreated(
object
sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e)
{
if
(e.TimeSlot.Duration.Days == 1)
{
DateTime date = e.TimeSlot.Start;
if
(date.DayOfWeek != DayOfWeek.Saturday && date.DayOfWeek != DayOfWeek.Sunday)
{
int
allocated = getAllocatedTime_Day(date,e.TimeSlot.Resource.Text);
if
(allocated <= 0)
e.TimeSlot.CssClass +=
"timeslot-empty"
;
else
if
(allocated < 25)
e.TimeSlot.CssClass +=
"timeslot-low"
;
else
if
(allocated < 45)
e.TimeSlot.CssClass +=
"timeslot-mediumlow"
;
else
if
(allocated < 65)
e.TimeSlot.CssClass +=
"timeslot-medium"
;
else
if
(allocated < 85)
e.TimeSlot.CssClass +=
"timeslot-mediumhigh"
;
else
if
(allocated <= 100)
e.TimeSlot.CssClass +=
"timeslot-high"
;
else
if
(allocated > 100)
e.TimeSlot.CssClass +=
"timeslot-overbooked"
;
else
e.TimeSlot.CssClass +=
"timeslot-empty"
;
}
}
}
private
int
getAllocatedTime_Day(DateTime time,
string
department)
{
return
r.Next(0,120);
}