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

Razor
 
             @( 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

Razor
 
             @( 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

Razor
 
             @( 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

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

Content(Kendo.Mvc.UI.TemplateBuilder)

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

Parameters

template - TemplateBuilder<TModel>

The content of the cell

Example

Razor
 
                @(Html.Kendo().Calendar()
                           .Name("calendar")
                           .MonthTemplate(monthTemplate => monthTemplate
                                    .Content(Html.Kendo().Template()
                                           .AddHtml("<div class='my-custom-cell'>${data.weekNumber}</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

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

Empty(Kendo.Mvc.UI.TemplateBuilder)

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

Parameters

template - TemplateBuilder<TModel>

The content of the empty cells.

Example

Razor
 
                @(Html.Kendo().Calendar()
                        .Name("calendar")
                        .MonthTemplate(Html.Kendo().Template()
                                .AddHtml("-")
                        )
                )
             

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

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

WeekNumber(Kendo.Mvc.UI.TemplateBuilder)

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

Parameters

template - TemplateBuilder<TModel>

The content of the week number cells.

Example

Razor
 
                @(Html.Kendo().Calendar()
                           .Name("calendar")
                           .MonthTemplate(monthTemplate => monthTemplate
                                    .WeekNumber(Html.Kendo().Template()
                                           .AddHtml("<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

Razor
 
             @( 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

Razor
 
             @( 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

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

ContentView(System.Web.IHtmlString)

Sets the content template partial view.

Parameters

value - System.Web.IHtmlString

The partial view that will be rendered for the content template.

Example

Razor
 
                @(Html.Kendo().Calendar()
                       .Name("calendar")
                       .Month(month =>
                       {
                          month.ContentView(Html.Partial("_CustomCommand"));   
                       })
                )
             

WeekNumberView(System.Web.IHtmlString)

Sets the weeknumber template partial view.

Parameters

value - System.Web.IHtmlString

The partial view that will be rendered for the week number template.

Example

Razor
 
                @(Html.Kendo().Calendar()
                       .Name("calendar")
                       .Month(month =>
                       {
                          month.WeekNumberView(Html.Partial("_CustomCommand"));   
                       })
                )
             

EmptyView(System.Web.IHtmlString)

Sets the empty template partial view.

Parameters

value - System.Web.IHtmlString

The partial view that will be rendered for the empty template.

Example

Razor
 
                @(Html.Kendo().Calendar()
                       .Name("calendar")
                       .Month(month =>
                       {
                          month.EmptyView(Html.Partial("_CustomCommand"));   
                       })
                )