This is a migrated thread and some comments may be shown as answers.

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

1 Answer 125 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 05 Nov 2018, 01:59 PM

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.

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 08 Nov 2018, 06:56 AM
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.
Tags
Grid
Asked by
Shawn
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or