Remove the SaturDay and Sunday Columns Color

9 posts, 0 answers
  1. Praba
    Praba avatar
    11 posts
    Member since:
    Nov 2006

    Posted 12 Nov 2008 Link to this post


    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.





  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 14 Nov 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. lea ginsberger
    lea ginsberger avatar
    27 posts
    Member since:
    Jan 2010

    Posted 07 Jun 2010 Link to this post

    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. 

  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 07 Jun 2010 Link to this post

    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.
  6. Prava kafle
    Prava kafle avatar
    212 posts
    Member since:
    Apr 2010

    Posted 03 Mar 2011 Link to this post

    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
  7. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 09 Mar 2011 Link to this post

    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!
  8. Prava kafle
    Prava kafle avatar
    212 posts
    Member since:
    Apr 2010

    Posted 14 Mar 2011 Link to this post

    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
  9. Kiran
    Kiran avatar
    1 posts
    Member since:
    Jul 2016

    Posted 15 Nov Link to this post

    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?

  10. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    290 posts

    Posted 16 Nov Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017