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

[Solved] Possible to change the background color of time slot?

6 Answers 327 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
mdonato
Top achievements
Rank 1
mdonato asked on 30 Apr 2008, 04:35 PM
I was wondering if it is possible to change the background color of the timeslot of the radscheduler control at runtime?  I'm looking for the kind of functionality that the specialdays has with the radcalendar control, but I don't know what event I should hook up to or if it is even possible.

Thanks,
Marcello

6 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 01 May 2008, 11:30 AM
Hello Marcello,

RadScheduler now has the TimeSlotCreated event which you can use to set the CssClass property of the TimeSlot:

protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)  
{  
    e.TimeSlot.CssClass = "MyCustomClass";  


All the best,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
mdonato
Top achievements
Rank 1
answered on 02 May 2008, 06:29 PM
That works great. 

        e.TimeSlot.CssClass =

"halfday"


Here is the css I used incase anyone is struggling with the same issue.

td.halfday>div

{

background-color:#ff9696;

}

Unless you put the >div selector in there it will not change the background color.

0
Albert
Top achievements
Rank 1
answered on 27 Jun 2008, 06:34 PM
This works fine in Month view but have you gotten it to work in Day or week view?
0
Peter
Telerik team
answered on 30 Jun 2008, 05:49 AM
Hello Albert,

Please, try the following selectors which should work for all views:
/*Day, Week, and MonthView*/ 
        div.rsContent .rsCell.MyCustomClass   
        {  
            backgroundgray;  
        }  
        /*Timeline view*/ 
        div.rsContent .rsTimelineTable .MyCustomClass   
        {  
            backgroundgray;  
        }         


Regards,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Albert
Top achievements
Rank 1
answered on 30 Jun 2008, 12:12 PM
Thank you!  I have also found that the previous example will work if you include the !important directive.

td.halfday>div

{

background-color:#ff9696 !important;

}

0
Peter
Telerik team
answered on 30 Jun 2008, 12:17 PM

Yes, "!important" always adds the greatest weight to the css selector.


Kind regards,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
mdonato
Top achievements
Rank 1
Answers by
Peter
Telerik team
mdonato
Top achievements
Rank 1
Albert
Top achievements
Rank 1
Share this question
or