New to Telerik UI for ASP.NET CoreStart a free 30-day trial

Dynamically Highlighting Specified Dates within the Month View of the Scheduler

Environment

ProductTelerik UI for ASP.NET Core Scheduler
Progress Telerik UI for ASP.NET Core versionCreated with the 2023.3.1010 version

Description

How can I highlight dynamically specific dates within the Scheduler month view on load?

Solution

  1. Handle the DataBound event of the Scheduler.

  2. Create an array of dates, which must be highlighted within the month view.

  3. Check if the current view is the month view.

  4. Select the Scheduler month table with jQuery and loop through the td elements.

  5. Get the time slot of the current table cell to access the startDate field by using the slotByElement() method.

  6. Check if the startDate matches the dates from the external collection of dates and add a custom highlightedDay class to the table cell element.

  7. 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:

More ASP.NET Core Scheduler Resources

See Also