RadCalendar Week

3 posts, 0 answers
  1. Bruno
    Bruno avatar
    11 posts
    Member since:
    Oct 2013

    Posted 06 Jan 2014 Link to this post

    Hello, I want to know how can i format a single week background in radcalendar.

    Exemple in attach.

    Thanks.

  2. Venelin
    Admin
    Venelin avatar
    352 posts

    Posted 09 Jan 2014 Link to this post

    Hello Bruno,

    One possible solution is to add the desired days to the SpecialDays collection and then OnDayRender server-side event iterate through it. If the day e.Day.Date is equal to day.Date, then set the CssClass property to some value for example "specialDay".

    protected void Calendar_OnDayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
    {
        RadCalendar calendar = sender as RadCalendar;
     
        foreach (RadCalendarDay day in calendar.SpecialDays) {
            if (e.Day.Date == day.Date) {
                e.Cell.CssClass = "specialDay";
            }
        }
    }

    Then define the desired styles for these days:

    CSS:

    .specialDay span,
    .specialDay a {
       background: red;
    }

    Regards,
    Venelin
    Telerik
    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 the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Bruno
    Bruno avatar
    11 posts
    Member since:
    Oct 2013

    Posted 09 Jan 2014 Link to this post

    Thanks a lot Vanelin. Works ;)
Back to Top