OnDayRender Client Side Data Access Preferred Method

2 posts, 0 answers
  1. Webmaster
    Webmaster avatar
    1 posts
    Member since:
    Dec 2009

    Posted 24 Mar 2010 Link to this post

    I need to be able to disable days based on changing dates in a database.  So my question is what would be the preferred method to do the client side updating to disable the dates?  I do not have access to the dates to be disabled in javascript.  Can I do a server side call in the client side OnDayRender?  Do I need to disable all potential dates when the control is first rendered?  This would not be my preferred method. Do I need to invalidate the control each time the month changes?  If so how would I do that?

  2. Radoslav
    Radoslav avatar
    1566 posts

    Posted 30 Mar 2010 Link to this post

    Hi Kris,

    The client-side DayRender event is fired for every calendar day cell when the calendar is rendered as a result of client-side navigation. This event can be used to apply final changes to the output (content and visual styles) just before the content is displayed. Checkout the following demo which shows how to utilize the DayRender client event to customize the appearance of the rendered date.
    DayRender Event

    Also checkout the forum link: Disable DatePicker Calendar Date on Client Side DayRender
    Additionally you could checkout the following code library example which demonstrates how to disable a calendar's days:

    Another approach could be to disable the days on the server. My suggestion would be to disable all the days of the month depending on the condition:
    protected void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
       if (e.Day.Date.Month.ToString() == "6")
           DateTime SpecialDate = Convert.ToDateTime("06/11/2009");
           if (e.Day.Date.Date != SpecialDate)
               // disable the selection for the specific day
               RadCalendarDay calendarDay = new RadCalendarDay();
               calendarDay.Date = e.Day.Date;
               calendarDay.IsSelectable = false;

    I hope this will help you in getting started.

    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top