Control inside CalendarDayTemplates.

5 posts, 1 answers
  1. Legalia
    Legalia avatar
    26 posts
    Member since:
    Nov 2008

    Posted 04 Jun 2009 Link to this post

    Hi,
    I am using calendar control with 'CalendarDayTemplates'. it contains some labels inside it. i am creating some special days from dates which are in my DB and assigning DayTemplateID.
    and i also want assign text for it from DB.
    But i am not able to find Labels in side 'CalendarDayTemplates' using FindControl or other way.

    can you please suggest any solution for this.
  2. Answer
    Veli
    Admin
    Veli avatar
    2002 posts

    Posted 09 Jun 2009 Link to this post

    Hello Legalia,

    When adding server side controls to  your special day templates, the controls' generated markup is added to your cell's Text property, but the server controls themselves are not created and available on the server. Therefore, you cannot find them in the cell wih FindControl(). Only their markup is rendered. Nevertheless, if you register some server-side events declaratively for these controls, their server events are available.

    If you still need to modify the special day template on the server, you can do it in RadCalendar's DayRender event, where you can modify the Text property of the e.Cell object representing the current rendering cell. You can even add your own server side controls to the collection, but as the DayRender event is fired after viewstate saving methods on the page, your controls will not be able to maintain their viewstate. At the least, this means that their server events will not be properly registered:

    void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e) 
        if (RadCalendar1.SpecialDays[0].Date == e.Day.Date) 
        { 
            Label label = new Label(); 
            label.Text = "123"
            e.Cell.Controls.Add(label); 
        } 


    Greetings,
    Veli
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Derek
    Derek avatar
    118 posts
    Member since:
    Oct 2008

    Posted 22 Dec 2009 Link to this post

    I've tried to customize the appearance of special days as well. I have a couple of suggestions that I'd find very valuable;

    • Include the ability to keep the calendar day displayed, via a simple T/F setting
    • Include the ability to add things to the day display for special days. For example, if I use a datareader to add special dates to my calendar, provide the option to add an object, or even to modify a standard property (i.e. TEXT) when the day is being added
    • For that matter, provide the ability to attach a data source directly to a calendar for special days

    I used to use the MX Kollection for events-type calendars, which made it very easy, but there's nothing comparable in the asp.net world -- at least not yet!
  5. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 23 Dec 2009 Link to this post

    Hi Derek,

    If I understand you correctly, you need some functionality to bind the special days collection of RadCalendar to a data source. While this is not available off-the-shelf in RadCalendar, I do not see any obstacles for you to simply query your data source, iterate over the result and create a special day for each data item, setting it up according to your data values.

    Regards,
    Veli
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Derek
    Derek avatar
    118 posts
    Member since:
    Oct 2008

    Posted 23 Dec 2009 Link to this post

    I just had a look at the Scheduler component, and it seems that the functionality I need is already in there.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017