Collor cell according to their class

4 posts, 0 answers
  1. Dani
    Dani avatar
    20 posts
    Member since:
    Dec 2011

    Posted 12 Dec 2011 Link to this post

    I'm getting data from database. I have two tables which create appointments. The classes which represent these tables differ by one boolean variable.

    I'm trying to color the cells from one of the table green.

    My css is here:
    .rsMonthView .rsAptContent 
                    {  
                      background: #D0ECBB;  
                    }
                    
                    .rsDayView .rsAptContent 
                    {  
                      background: #D0ECBB;  
                    }
                    
                    .rsWeekView .rsAptContent 
                    {  
                      background: #D0ECBB; 
                    }
                    
                    .rsTimelineView .rsAptContent 
                    {  
                      background: #D0ECBB;  
                    }


    How to check which table from is the cell?
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 12 Dec 2011 Link to this post

    Hi Dani,

    You can handle AppointmentDataBound and set the appointment's CssClass property conditionally. Then you can leverage the rendered css to style the appointments uniquely per RadScheduler instance.

    Best wishes,
    Peter
    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. Dani
    Dani avatar
    20 posts
    Member since:
    Dec 2011

    Posted 13 Dec 2011 Link to this post

    I added the AppointmentDataBound event but it never gets called.
    I put breakpoint in its beginning and it's never hit.
  4. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 13 Dec 2011 Link to this post

    Hi Dani,

    AppointmentDataBound will not fire if you use a Web Service to populate RadScheduler. In this case you should handle OnClientAppointmentDataBound like this:
    Copy Code
    function OnClientAppointmentDataBound(sender, eventArgs) {
    var app = eventArgs.get_appointment();
    //debugger;
    var backColor = app.get_attributes().getAttribute("AppointmentColor");
    if (backColor)
    app.set_backColor(backColor);
    app.set_borderColor("black");
    app.set_borderWidth("1");
    }

    You can download a working sample from here (WebServiceBinding).


    Best wishes,
    Peter
    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
Back to Top