How to color code Appointments in telerik Radschedular

I have to show appointments in telerik radschedular with different background colors, depending on their status.


I have used RadScheduler1_AppointmentDataBound event to achieve this.

Protected Sub RadScheduler1_AppointmentDataBound(sender As Object, e As SchedulerEventArgs) Handles RadScheduler1.AppointmentDataBound
    Dim pf As AppointmentInfo = e.Appointment.DataItem
    e.Appointment.ForeColor = Color.AntiqueWhite
    If StatusID = 1 Then
        e.Appointment.BackColor = ColorTranslator.FromHtml("#800000")
    ElseIf StatusID = 2 Then
        e.Appointment.BackColor = ColorTranslator.FromHtml("#FF0000")
    ElseIf StatusID = 3 Then
        e.Appointment.BackColor = ColorTranslator.FromHtml("#0000FF")
    ElseIf StatusID = 4 Then
        e.Appointment.BackColor = ColorTranslator.FromHtml("#008000")
    ElseIf StatusID = 5 Then
        e.Appointment.BackColor = ColorTranslator.FromHtml("#800080")
    ElseIf StatusID = 6 Then
        e.Appointment.BackColor = ColorTranslator.FromHtml("#666666")
    ElseIf StatusID = 8 Then
        e.Appointment.BackColor = ColorTranslator.FromHtml("#333333")
        e.Appointment.BackColor = ColorTranslator.FromHtml("#FF66CC")
    End If
End Sub
Subscribe for our monthly newsletter for updated articles and useful code scripts.

Share It

comments powered by Disqus