Bind and Enable dates to Datepicker

4 posts, 0 answers
  1. Jeff Wickersham
    Jeff Wickersham avatar
    24 posts
    Member since:
    Mar 2009

    Posted 05 Aug 2012 Link to this post

    I need some guidance on how to accomplish the following.
    1. Need to bind datepicker to datatable or list
    2. Then only highlight and enable the dates in that datatable or list, all other dates to be disabled

    Thanks
  2. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 09 Aug 2012 Link to this post

    Hi Jeff,

    You can use the DayRender server and client events of the calendar to disable dates, as shown in this code library:
    http://www.telerik.com/community/code-library/aspnet-ajax/calendar/disabling-calendar-days.aspx

    As for getting them from database, you can build server and client collections of the dates from DB and use them when executing the logic to disable certain days in the calendar.

    Regards,
    Tsvetina
    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. Gerd
    Gerd avatar
    4 posts
    Member since:
    Aug 2012

    Posted 30 Aug 2012 Link to this post

    Hello,

    Is there also a possibility to disable all the dates first ?  E.g. DatePicker.Dates.DisablaAll
    So we can set only date A and B to be enabled with the SpecialDays

    thanks
    gerd
  5. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 03 Sep 2012 Link to this post

    Hi Gerd,

    There is not such option for RadCalendar, as the month views are built on the fly, they are not initially available. One option would be to set AutoPostBack="true" for the calendar, and on the server DayRender event disable/enable dates based on DB values. To prevent the page from reloading on navigation, you could wrap the RadCalendar in a RadAjaxPanel or add it to a RadAjaxManager setting where it updates itself.

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