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

Changing background color of certain appointments in RadScheduler agenda view

0 Answers 110 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Cathal
Top achievements
Rank 1
Cathal asked on 02 Aug 2017, 12:40 PM

I have a radScheduler agenda view and I want to change the color of certain entries in the scheduler. I want to do something like this http://imgur.com/a/2ot4X where some rows are a certain color

This is my code at the moment but it is not working  

1.<p>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;</p><p>}</p>

This is the code for the rad scheduler.

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>

No answers yet. Maybe you can help?

Tags
Scheduler
Asked by
Cathal
Top achievements
Rank 1
Share this question
or