Dear Team mates,
I've a problem with the RadScheduler TimeSlot. and I want to remove the Default Week-end Column Color and Adding colour to some other column using the following code.
void RadScheduler1_TimeSlotCreated(object sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e)
{
if (e.TimeSlot.Start.Date.DayOfWeek == DayOfWeek.Friday)
e.TimeSlot.CssClass = "rsSunCol";
else if (e.TimeSlot.Start.Date.DayOfWeek == DayOfWeek.Thursday)
e.TimeSlot.CssClass = "rsSatCol";
else
e.TimeSlot.CssClass.Replace("rsSunCol", string.Empty); // e.TimeSlot.CssClass = string.Empty;
}
as it's given in the existing code, Friday and Thursday has it's differentiation with the different week-end color. but I cannot remove the Saturday and Sunday Color.
please let me know hot to replace the CssClass of the default week-end (Sat & Sun) as a normal column.
Thanks in Advance.
8 Answers, 1 is accepted
With Q3 2008 we introduced a new ISchedulerTimeSlot property – Control. This is a reference to the rendered control (typically a TableCell) that represents this time slot. You can use the Control property to achieve your goal as follows:
protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e) |
{ |
if (e.TimeSlot.Start.Date.DayOfWeek == DayOfWeek.Friday) |
e.TimeSlot.Control.CssClass = "rsSunCol"; |
else if (e.TimeSlot.Start.Date.DayOfWeek == DayOfWeek.Thursday) |
e.TimeSlot.Control.CssClass = "rsSatCol"; |
else |
e.TimeSlot.Control.CssClass = String.Empty; |
} |
All the best,
Peter
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I need to do like in Israel.
if (e.TimeSlot.Start.Date.DayOfWeek == DayOfWeek.Friday)
e.TimeSlot.CssClass =
"rsSatCol";
else if (e.TimeSlot.Start.Date.DayOfWeek == DayOfWeek.Saturday)
e.TimeSlot.CssClass =
"rsSunCol";
else
e.TimeSlot.CssClass =
String.Empty;
with e.TimeSlot.Control.CssClass -nothing happens.
and like I did the friday get a Correct color but sunday is still get color like weekend.
how can remove the color from sunday.
The .rsSunCol class will still render for Sundays even if you set e.TimeSlot.CssClass = String.Empty; for those time slots.
Here is a solution I recommend you try:
protected
void
RadScheduler1_TimeSlotCreated(
object
sender, TimeSlotCreatedEventArgs e)
{
if
(e.TimeSlot.Start.Date.DayOfWeek == DayOfWeek.Friday)
e.TimeSlot.CssClass =
"rsSatCol"
;
}
<style type=
"text/css"
>
.rsSunCol
{
background
:
none
!important
;
}
</style>
Best wishes,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I am giving a colorful background for some cells in Radscheduler. However Timeslot's css class does not persist after post back.
protected void rsTicketsSchedule_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
{
if(condition1)
e.TimeSlot.CssClass = "Enabled";
if(condition2)
e.TimeSlot.CssClass = "Current";
}
How can I make Radscheduler persist its TimeSlot's .CssClass.
Thanks,
Prava
The TimeSlot created will occur again on posback, so the styles should persist. We have actually a kb article which relies on this approac:
http://www.telerik.com/support/kb/aspnet-ajax/scheduler/setting-special-days-or-time-slots-in-radscheduler.aspx
I am not sure why this is not working for your case, but if you can open a support ticket and send us a working demo, we will be glad to look into it.
Best wishes,
Peter
the Telerik team
My Radscheduler was not rendering with proper CSS class because of a bug in my code, I had conditional statement and its value was null after postback . I fixed the bug and everything is working perfectly.
Thank you for your feed back.
Prava
Hello,
Using the below code
.rsSunCol
{
background: none !important;
}
Also disables the hover functionality for the slot. Is the way to retain this functionality while changing the color?
To have a different hover state, you will have to define explicitly the background too:
html .RadScheduler .rsSunCol {
background: none;
}
html .rsSunCol.rsAptCreate {
background: blue;
}
Note that I have used stronger CSS selectors, instead of the !important directive.
Regards,
Veselin Tsvetanov
Telerik by Progress