Creating a Date Template for Each Day

3 posts, 0 answers
  1. Eric
    Eric avatar
    32 posts
    Member since:
    Jun 2011

    Posted 18 May 2012 Link to this post

    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. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 23 May 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Eric
    Eric avatar
    32 posts
    Member since:
    Jun 2011

    Posted 23 May 2012 Link to this post

    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.
Back to Top