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

Css not rendering on load

1 Answer 80 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 15 Mar 2012, 04:37 PM
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);
}

1 Answer, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 20 Mar 2012, 12:59 PM
Hello Adam,

I have tried to reproduce this behavior but to no avail. All style set to RadScheduler in code-behind is applied on the initial load of RadScheduler.

Could you provide us with some more information regarding this behavior? What version of RadControls are you using? Does this behavior stays the same with the last version of RadControls? Does it depend on the browser under which you are viewing the page, or it stays the same in more browsers (like IE, Firefox, Chrome)?
Also I would really appreciate if you could isolate this behavior in a sample page and send it to us -- this way we will be able to troubleshoot the problem locally and provide you with a solution if possible.

Greetings,
Ivana
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.
Tags
Scheduler
Asked by
Adam
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Share this question
or