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

RadCalendar Week

2 Answers 100 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Bruno
Top achievements
Rank 1
Bruno asked on 06 Jan 2014, 11:42 AM
Hello, I want to know how can i format a single week background in radcalendar.

Exemple in attach.

Thanks.

2 Answers, 1 is accepted

Sort by
0
Venelin
Telerik team
answered on 09 Jan 2014, 09:12 AM
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.
0
Bruno
Top achievements
Rank 1
answered on 09 Jan 2014, 09:44 AM
Thanks a lot Vanelin. Works ;)
Tags
Calendar
Asked by
Bruno
Top achievements
Rank 1
Answers by
Venelin
Telerik team
Bruno
Top achievements
Rank 1
Share this question
or