Change background colour of cell in timeline view

3 posts, 1 answers
  1. Karl
    Karl avatar
    172 posts
    Member since:
    Sep 2010

    Posted 05 Mar 2013 Link to this post

    I need to be able to change the background colour of the cell for a given day and resource in timeline view to show days when a resource is not available (weekends etc, but could be any day)

    Can this be done and if so, how?

    Is there a "day render" event for the ASP.Net RadScheduler that I could use and then set some style on the cell?

    Thanks
  2. Answer
    Plamen
    Admin
    Plamen avatar
    3079 posts

    Posted 08 Mar 2013 Link to this post

    Hello Karl,

     
    Thank you for contacting Telerik support.

    Here is  a sample code how to achieve this by using the TimeSlotCreated event:

    protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
       {
           RadScheduler scheduler = (RadScheduler)sender;
           if (scheduler.SelectedView==SchedulerViewType.TimelineView)
           {
               if (e.TimeSlot.Resource.Text=="Alex")
               {
                   if (e.TimeSlot.Start.DayOfWeek == DayOfWeek.Sunday || e.TimeSlot.Start.DayOfWeek == DayOfWeek.Saturday)
                   {
                       e.TimeSlot.CssClass = "Grey";
                   }
               }
               
               
           }
           
            
       }
    <style type="text/css">
           .Grey {
           background-color:gray;
           }
       </style>

    You can also review this on-line demo where similar behavior have been implemented.

    Hope this will be helpful. If you have further questions I will be glad to assist you again.

    Kind regards,
    Plamen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Karl
    Karl avatar
    172 posts
    Member since:
    Sep 2010

    Posted 08 Mar 2013 Link to this post

    Thanks, thats exactly what I was after...
Back to Top