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

Different background color

1 Answer 38 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Lovella Bacaud
Top achievements
Rank 1
Lovella Bacaud asked on 13 May 2013, 03:00 AM
Hi Guys,

In the Radschedulder demo, different appointments have different background color. Their demo code seems too bulky. How to achieve the same? I would like to have different color based on my various resources. Can anyone tell me with some code snippet?

Thanks for reply
Lovella

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 May 2013, 04:36 AM
Hi Lovella,

You can set the background color based on the various resources in the AppointmentDataBound server-side event. Please have a look at the following code snippet.

ASPX:
<ResourceStyles>
     <telerik:ResourceStyleMapping Type="User" Text="ASP" BackColor="Blue" />
     <telerik:ResourceStyleMapping Type="User" Text="JSP" BackColor="Orange" />
     <telerik:ResourceStyleMapping Type="User" Text="Java" ApplyCssClass="rsCategoryGreen" />
</ResourceStyles>

C#:
protected void RadScheduler1_AppointmentDataBound(object sender, Telerik.Web.UI.SchedulerEventArgs e)
{
    if (e.Appointment.Resources.GetResourceByType("User") != null)
    {
        switch (e.Appointment.Resources.GetResourceByType("User").Text)
        {
            case "ASP":
                e.Appointment.BackColor = Color.Blue;
                break;
            case "JSP":
                e.Appointment.BackColor = Color.Orange;
                break;
            case "Java":
                e.Appointment.CssClass = "rsCategoryGreen";
                break;
            default:
                break;
        }
    }
}

Also please have a look at this demo on Resources to know more about it.

Thanks,
Shinu.
Tags
Scheduler
Asked by
Lovella Bacaud
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or