New to Telerik UI for ASP.NET Core? Start a free 30-day trial
Dynamically Highlighting Specified Dates within the Month View of the Scheduler
Environment
Product | Telerik UI for ASP.NET Core Scheduler |
Progress Telerik UI for ASP.NET Core version | Created with the 2023.3.1010 version |
Description
How can I highlight dynamically specific dates within the Scheduler month view on load?
Solution
-
Handle the
DataBound
event of the Scheduler. -
Create an array of dates, which must be highlighted within the month view.
-
Check if the current view is the month view.
-
Select the Scheduler month table with jQuery and loop through the
td
elements. -
Get the time slot of the current table cell to access the
startDate
field by using theslotByElement()
method. -
Check if the
startDate
matches the dates from the external collection of dates and add a customhighlightedDay
class to the table cell element. -
Add the desired background color to the
highlightedDay
with CSS.Razor@(Html.Kendo().Scheduler<Kendo.Mvc.Examples.Models.Scheduler.TaskViewModel>() .Name("scheduler") .Views(views => { views.DayView(); views.WeekView(); views.MonthView(mView => { mView.Selected(true); }); views.YearView(); }) .Events(ev => ev.DataBound("onDataBound")) ... )
For a runnable example based on the code above, refer to the following REPL samples: