New to Telerik UI for ASP.NET MVC? Download free 30-day trial

MonthTemplateBuilder

Methods

ContentId(System.String)

Sets the template that renders the cells in the 'month' view.

Parameters

id - System.String

The id of the external Kendo UI template.

Example


             @( Html.Kendo().Calendar()
                        .Name("calendar")
                        .MonthTemplate(x => x.ContentId("cell-template"))
            )
            <script id="cell-template" type="text/x-kendo-template">
              <div class="#= data.value < 10 ? 'exhibition' : 'party' #">
                  #= data.value #
              </div>
            </script>

EmptyId(System.String)

Sets the template that renders the cells in the 'month' view, which are not in the min/max range.

Parameters

id - System.String

The id of the external Kendo UI template.

Example


             @( Html.Kendo().Calendar()
                        .Name("calendar")
                        .Min("01/01/2024")
                        .Max("10/01/2024")
                        .MonthTemplate(x => x.EmptyId("cell-template"))
            )

WeekNumberId(System.String)

Sets the template that renders the cells in "week number" column.

Parameters

id - System.String

The id of the external Kendo UI template.

Example


             @( Html.Kendo().Calendar()
                        .Name("calendar")
                        .MonthTemplate(x => x.WeekNumberId("week-number-template"))
            )
            <script id="week-number-template" type="text/x-kendo-template">
              <span class='custom-week-num'>#=data.weekNumber #</span>
            </script>

Content(System.String)

Sets the template that renders the cells in the 'month' view.

Parameters

content - System.String

The content of the cell.

Example


             @( Html.Kendo().Calendar()
                        .Name("calendar")
                        .MonthTemplate(x => x.Content("<div class='my-custom-cell'>#= data.value#</div>"))
            )

Empty(System.String)

Sets the template that renders the cells in the 'month' view, which are not in the min/max range.

Parameters

empty - System.String

The content of the empty cells.

Example


             @( Html.Kendo().Calendar()
                        .Name("calendar")
                        .MonthTemplate(x => x.Empty("-"))
            )

WeekNumber(System.String)

Sets the template that renders the cells in "week number" column.

Parameters

weekNumber - System.String

The content of the week number cells.

Example


             @( Html.Kendo().Calendar()
                        .Name("calendar")
                        .MonthTemplate(x => x.WeekNumber("<div class='my-custom-cell'>#= data.weekNumber#</div>"))
            )

ContentHandler(System.String)

Sets the template that renders the cells in the "month" view.

Parameters

content - System.String

The JavaScript function that will return the content of the cells in the "month" view.

Example


             @( Html.Kendo().Calendar()
                        .Name("calendar")
                        .MonthTemplate(x => x.ContentHandler("monthTemplate"))
            )
            <script>
               function monthTemplate(data) {
                    if(data.value < 10) {
                        return 'exhibition';
                    }
                    return 'party';
                }
            </script>

EmptyHandler(System.String)

Sets the template that renders the cells in the "month" view, which are not in the min/max range.

Parameters

empty - System.String

The JavaScript function that will return the content of the cells in the "month" view.

Example


             @( Html.Kendo().Calendar()
                        .Name("calendar")
                        .MonthTemplate(x => x.EmptyHandler("emptyTemplate"))
            )
            <script>
               function emptyTemplate(data) {
                    return '-';
                }
            </script>

WeekNumberHandler(System.String)

Sets the template that renders the cells in "week" column.

Parameters

weekNumber - System.String

The JavaScript function that will return the content of the cells in the "week" column.

Example


             @( Html.Kendo().Calendar()
                        .Name("calendar")
                        .MonthTemplate(x => x.WeekNumberHandler("weekNumberTemplate"))
            )
            <script>
               function weekNumberTemplate(data) {
                    return `<span>${data.weekNumber }</span>`;
                }
            </script>

In this article
Not finding the help you need?