Different background color

2 posts, 0 answers
  1. Lovella Bacaud
    Lovella Bacaud avatar
    20 posts
    Member since:
    Apr 2013

    Posted 12 May 2013 Link to this post

    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
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 May 2013 Link to this post

    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.

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

    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;
                case "JSP":
                    e.Appointment.BackColor = Color.Orange;
                case "Java":
                    e.Appointment.CssClass = "rsCategoryGreen";

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

Back to Top