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

Creating a Date Template for Each Day

2 Answers 26 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 18 May 2012, 01:17 PM
I'm trying to create a RadCalendar where everyday has both the number of the date, plus a label or a textbox, depending on whether or not the user has logged in that day. The issue I'm having, is that I'd like to style the date cells by using a DayTemplate, but I need access to the controls inside.

To make matters more difficult, I'm using .NET 3.5 (for Sharepoint), and I don't think there is a "Static" option for IDs. Currently, my gameplan is to design the cell in the DayTemplate, and then have the  OnDayRender event take the controls inside the template and modify them. Is this the correct approach? Each control gets prefixed when a DayTemplate is applied, so it makes grabbing them extremely tough.

Aside from OnDayRender (or making 7 special days that repeat weekly), is there a way to set up a generic template for each cell, one that I can programmatically get access to?

2 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 23 May 2012, 11:09 AM
Hello Eric,

Your approach is correct. Apart from that, in order to access your controls, just use a programmatic template as demonstrated in the attached sample. In the InstantiateIn method you will get access to all the controls in the template.


Greetings,
Tsvetoslav
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.
0
Eric
Top achievements
Rank 1
answered on 23 May 2012, 03:23 PM
Thanks for the example.

I submitted a support ticket as I can't subscribe to events in the ITemplate, so I believe this thread should be closed.

Thanks.
Tags
Calendar
Asked by
Eric
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Eric
Top achievements
Rank 1
Share this question
or