Styling appointment based on resource type.

2 posts, 1 answers
  1. Antony
    Antony avatar
    32 posts
    Member since:
    Feb 2013

    Posted 07 Mar 2013 Link to this post

    Hi,

    I have a RadScheduler in my project and I want to style the appointment based on the resource type. I got three companies apointment in my RadScheduler and based on these company names, I want the appointments to be displayed with different styles from CS. Please help.

    Thanks in advance,
    Antony.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 07 Mar 2013 Link to this post

    Hello Antony,

    You can use the AppointmentDataBound server-side event to give different styles to appointment based on the resources. Please have a look at the following code to understand how to give different styles to appointment based on the resource type from code behind.

    C#:
    protected void RadScheduler1_AppointmentDataBound(object sender, Telerik.Web.UI.SchedulerEventArgs e)
    {
        if (e.Appointment.Resources.GetResourceByType("Company") != null)
        {
            switch (e.Appointment.Resources.GetResourceByType("Company").Text)
            {
                case "Company1":
                    e.Appointment.CssClass = "rsCategoryBlue";
                    break;
                case "Company2":
                    e.Appointment.CssClass = "rsCategoryOrange";
                    break;
                case "Company3":
                    e.Appointment.CssClass = "rsCategoryGreen";
                    break;
                default:
                    break;
            }
        }
    }

    Thanks,
    Princy.
Back to Top