OnDayRender not fired initially

2 posts, 0 answers
  1. Jeff Nafe
    Jeff Nafe avatar
    46 posts
    Member since:
    Sep 2007

    Posted 16 Dec 2008 Link to this post

    We have custom code in the client side OnDayRender event to disable all days except Mondays for certain situations. My problem is that this code runs when a month changes (causing a re-draw of the calendar), but it doesn't fire when the calendar initially loads upon the page loading. So, initially the non-Mondays are improperly enabled. Once I start navigating around, this code gets fired and I'm all good.

    Is there a reason why this isn't fired initially. Is there a different event I can tap into to execute this same code for the initial month?

    Thanks!

    Jeff
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 19 Dec 2008 Link to this post

    Hi Jeff,

    Initially RadCalendar is rendered on the server and that is why OnDayRender client-side event is not raised. Possible approach is to register desired script using server-side DayRender event. Here is an example:
      
        void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
        {
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), e.Day.Date.ToString(), "alert('RadCalendar1_DayRender');", true);
        }

    Regards,
    Vlad
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top