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

[Solved] Changing Appointment Fore Color during runtime

2 Answers 181 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Hao Zhi
Top achievements
Rank 1
Hao Zhi asked on 07 Apr 2009, 05:00 AM
I am using Vista theme for this RadScheduler. I have the following code which is executed during run-time. But the fore color of the appointment does not change.

 If obj_Appoint.Pax >= FnBDALC.GetDALC.GetFnBOutletThresholdByOutletCode(obj_Appoint.Outlet) Then
               objTelerik_Web_UI_Appointment_ForeColor = Drawing.Color.Red
Else
               objTelerik_Web_UI_Appointment_ForeColor = Drawing.Color.Blue
 End If

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 08 Apr 2009, 11:39 AM
Hi Hao Zhi,

As of the Q1 release Appointment.Color property no longer works. Instead we provide CSS classes that can be set to the Appointment.CssClass property. There is going to be a help article on the topic available soon. The currently available CSS classes are:

rsCategoryBlue     
rsCategoryDarkBlue 
rsCategoryDarkGreen 
rsCategoryDarkRed   
rsCategoryGreen    
rsCategoryOrange
rsCategoryPink
rsCategoryRed
rsCategoryViolet
rsCategoryYellow

You can set the latter classes either in AppointmentCreater or AppointmentDataBound events of the RadScheduler Example:

 protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e) 
    { 
        DayOfWeek day = e.Appointment.Start.DayOfWeek; 
 
        switch (day) 
        { 
            case DayOfWeek.Monday: 
                e.Appointment.CssClass = "rsCategoryRed"
                break
            case DayOfWeek.Saturday: 
                e.Appointment.CssClass = "rsCategoryPink"
                break
        } 
    } 


All the best,
Genady Sergeev
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
vin
Top achievements
Rank 1
answered on 09 Apr 2009, 06:43 AM
 Protected Sub rdSchedulerLeaveCalendar_AppointmentCreated(ByVal sender As System.Object, ByVal e As Telerik.Web.UI.AppointmentCreatedEventArgs) Handles rdSchedulerLeaveCalendar.AppointmentCreated
    
        Try
                      e.Appointment.ForeColor = System.Drawing.Color.FromName(dsColor.Tables(0).Rows(0).Item("Color").ToString())
        Catch ex As Exception

        End Try

    End Sub


here dsColor dataset is the color from database
Tags
Scheduler
Asked by
Hao Zhi
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
vin
Top achievements
Rank 1
Share this question
or