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

Remove the SaturDay and Sunday Columns Color

8 Answers 136 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Praba
Top achievements
Rank 1
Praba asked on 12 Nov 2008, 09:27 AM

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

Sort by
0
Peter
Telerik team
answered on 14 Nov 2008, 01:25 PM
Hi Praba,

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.
0
lea ginsberger
Top achievements
Rank 1
answered on 07 Jun 2010, 09:50 AM

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. 

0
Peter
Telerik team
answered on 07 Jun 2010, 11:57 AM
Hi lea,

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.
0
Prava kafle
Top achievements
Rank 1
answered on 03 Mar 2011, 11:04 PM
Hi,
  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
0
Peter
Telerik team
answered on 09 Mar 2011, 01:27 PM
Hi 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
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Prava kafle
Top achievements
Rank 1
answered on 14 Mar 2011, 07:10 PM
Hi Peter,

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
0
Kiran
Top achievements
Rank 1
answered on 15 Nov 2016, 11:53 AM

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?

0
Veselin Tsvetanov
Telerik team
answered on 16 Nov 2016, 01:59 PM
Hello Kiran,

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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Scheduler
Asked by
Praba
Top achievements
Rank 1
Answers by
Peter
Telerik team
lea ginsberger
Top achievements
Rank 1
Prava kafle
Top achievements
Rank 1
Kiran
Top achievements
Rank 1
Veselin Tsvetanov
Telerik team
Share this question
or