How do I set "SpecialDays" and "RecurringEvents" to today's date in a GridDateTimeColumn in Edit mode?

2 posts, 0 answers
  1. Shawn
    Shawn avatar
    53 posts
    Member since:
    Jun 2014

    Posted 05 Nov 2018 Link to this post

    Hello,

    I'm trying to figure out how to set the "SpecialDays", "RecurringEvents", and "ItemStyle-BackColor" of the rendered RadDatePicker for the RadDateTimeColumn in my RadGrid during edit mode.  I want the user to see today's date highlighted when they click on the DatePicker.  It's easy to do this in a regular RadDatePicker control, but I don't know how to do this in a RadGrid.  Any help is appreciated.

    Thanks,

    Shawn A.

  2. Eyup
    Admin
    Eyup avatar
    3692 posts

    Posted 08 Nov 2018 Link to this post

    Hi Shawn,

    Generally, probably as you are already aware, you can achieve this requirement by adding a SpecialDay to the Calendar of the picker control:
    https://docs.telerik.com/devtools/aspnet-ajax/controls/calendar/how-to/highlight-today-date.html

    When the picker is placed within a grid template, you can use the same approach.

    When the picker is generated automatically by the grid, you add the SpecialDay to its SharedCalendar instance.

    First, you can access it during ItemDataBound:
    https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows#accessing-controls-in-editinsert-mode

    Then, create a new special day and add it to the SharedCalendar of the picker, not its Calendar instance.

    If ItemDataBound is too late, you can do this logic in the ItemCreated event handler:
    https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/control-lifecycle/differences-between-itemcreated-and-itemdatabound-

    I hope this will prove helpful. Give it a try and let me know if it works for you.

    Regards,
    Eyup
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top