Changing background color of certain appointments in RadScheduler agenda view

1 posts, 0 answers
  1. Cathal
    Cathal avatar
    2 posts
    Member since:
    Aug 2017

    Posted 02 Aug 2017 Link to this post

    I have a radscheduler with agenda view. I want to change the color of certain rows like such: http://imgur.com/a/2ot4X

    This is my radScheduler : 

    1.<telerik:RadScheduler runat="server" ID="rs_Calendar"<br>                    SelectedView="AgendaView" AllowEdit="false" AllowDelete="false"<br>                    Height="100%" OverflowBehavior="Expand"<br>                    Width="100%" DataKeyField="TourInstanceId" DataSubjectField="Title"<br>                    DataStartField="DateStart" DataEndField="DateEnd" BackColor="#E6E6E6"<br>                    Skin="Metro" <br>                    OnAppointmentDataBound="rs_Calendar_AppointmentDataBound"<br>                     OnAppointmentCreated="RadScheduler1_AppointmentCreated"<br>                    OnNavigationComplete="rs_Calendar_NavigationComplete"<br>                    OnClientAppointmentInserting="CancelEvent"<br>                    OnClientAppointmentEditing="CancelEvent"<br>                    CustomAttributeNames="Color,TourInstanceId,Title,Bookings,Guideinitials,Availability,GroupName"<br>                    OnClientAppointmentMoveEnd="MoveAppt"<br>                    OnClientAppointmentResizeStart="ResizeAppt"<br>                    OnClientAppointmentClick="onClientAppointmentClick"<br>                    OnClientAppointmentDoubleClick="onClientAppointmentDoubleClick"><br>                    <WeekView UserSelectable="false" /><br>                    <DayView UserSelectable="false" /><br>                    <MonthView UserSelectable="true" /><br>                    <MultiDayView UserSelectable="false" /><br>                    <TimelineView UserSelectable="true" /><br>                    <AgendaView UserSelectable="true" /><br>                    <AppointmentTemplate><br>                        <div class="appt-title" style="border-color: <%# Eval("Attributes['BackGroundColor']") %>; color: <%# Eval("Attributes['TextColor']") %>;"><br><br>                            <span runat="server" id="calendar_icons_alerts"><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Completed']") %>" alt="Completed" width="20px" style="display: <%# Eval("Attributes['Completed']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Closed']") %>" alt="Closed" width="20px" style="display: <%# Eval("Attributes['Closed']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Custom']") %>" alt="Custom" width="50px" style="display: <%# Eval("Attributes['Custom']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Transfer']") %>" alt="Transfer" width="50px" style="display: <%# Eval("Attributes['Transfer']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Attention']") %>" alt="Attention" width="20px" style="display: <%# Eval("Attributes['Attention']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['No Bookings']") %>" alt="No Bookings" width="20px" style="display: <%# Eval("Attributes['No Bookings']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Headsets']") %>" alt="Headsets" width="20px" style="display: <%# Eval("Attributes['Headsets']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Bikes']") %>" alt="Bikes" width="20px" style="display: <%# Eval("Attributes['Bikes']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Tickets']") %>" alt="Tickets" width="20px" style="display: <%# Eval("Attributes['Tickets']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Guide']") %>" alt="Guide" width="20px" style="display: <%# Eval("Attributes['Guide']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Money']") %>" alt="Money" width="20px" style="display: <%# Eval("Attributes['Money']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Kids']") %>" alt="Kids" width="20px" style="display: <%# Eval("Attributes['Kids']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Voucher']") %>" alt="Voucher" width="20px" style="display: <%# Eval("Attributes['Voucher']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Arrange Transfer']") %>" alt="Arrange Transfer" width="20px" style="display: <%# Eval("Attributes['Arrange Transfer']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Radio']") %>" alt="Radio" width="20px" style="display: <%# Eval("Attributes['Radio']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['VIP client']") %>" alt="VIP client" width="20px" style="display: <%# Eval("Attributes['VIP client']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Finelli & Shaw']") %>" alt="Finelli & Shaw" width="20px" style="display: <%# Eval("Attributes['Finelli & Shaw']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Trip planning']") %>" alt="Trip planning" width="20px" style="display: <%# Eval("Attributes['Trip planning']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['People Together']") %>" alt="People Together" width="20px" style="display: <%# Eval("Attributes['People Together']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Press']") %>" alt="Press" width="20px" style="display: <%# Eval("Attributes['Press']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Restaurant Reservation']") %>" alt="Restaurant Reservation" width="20px" style="display: <%# Eval("Attributes['Restaurant Reservation']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Pick Up Location']") %>" alt="Pick Up Location" width="20px" style="display: <%# Eval("Attributes['Pick Up Location']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Drop Off Location']") %>" alt="Drop Off Location" width="20px" style="display: <%# Eval("Attributes['Drop Off Location']")!=null ? "inline-block": "none" %>" /><br>                                <img class="icons_on_calendar" src="<%# Eval("Attributes['Meeting Point']") %>" alt="Meeting Point" width="20px" style="display: <%# Eval("Attributes['Meeting Point']")!=null ? "inline-block": "none" %>" /><br>                            </span><br><br>                            <%# Eval("Subject") %><br>                        </div><br>                    </AppointmentTemplate><br>                </telerik:RadScheduler>

    This is my c# code but the color is currently never changing:

    protected void rs_Calendar_AppointmentDataBound(object sender, SchedulerEventArgs e)

    {

     if (e.Appointment.DataItem is vw_CalendarDate)

       {

       vw_CalendarDate ce = (vw_CalendarDate)e.Appointment.DataItem;
       if (ce.Title != null && ce.Title.ToLower().StartsWith("sgt"))
        e.Appointment.BackColor = Color.Red;
      }
    }
Back to Top