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

Selecting Week Days in the DatePicker

Environment

ProductTelerik UI for ASP.NET Core DatePicker
Progress Telerik UI for ASP.NET Core versionCreated with the 2022.3.913 version

Description

How can I select the days of the week from the Telerik UI for ASP.NET Core DatePicker?

Solution

  1. Hide the initially rendered days of the week within the Popup Calendar of the DatePicker for Telerik UI for ASP.NET Core.
  2. Create a flag variable which will hold the days of the week.
  3. To select the days of the week, handle the .MonthTemplate() and pass the current date as an argument.
  4. Within the function handler, parse the date argument to a Date object. To get the current day, use the .getDay() method and obtain it from the previously defined flag variable.
Index.cshtml
    @(Html.Kendo().DatePicker()
          .Name("datepicker")
          .Value(DateTime.Today)
          .Footer("Today - #=kendo.toString(data, 'd') #")
          .MonthTemplate(month => month.Content("#= getDays(date) #"))
    )

For the complete implementation of the suggested approach, refer to the Telerik REPL example on selecting the days of the week within the DatePicker.

More ASP.NET Core DatePicker Resources

See Also