How put kendo template to js file and use in html

449 Views Asked by At

I want to dynamically change and load templates.How put kendo template to js file and use in html.

@(Html.Kendo().TileLayout()
            .Name("tilelayout")
            .Columns(100)
            .RowsHeight("100%")
            .Height("100%")
            .ColumnsWidth("100%")
            .Containers(c => {
                if(@Model==1)
            {
                c.Add().Header(h => h.Text("Входящие документы")).BodyTemplateId("inboxdocuments1").ColSpan(75).RowSpan(2);
            }
            else
            {
                 c.Add().Header(h => h.Text("Входящие документы")).BodyTemplateId("inboxdocuments2").ColSpan(75).RowSpan(2);
            }
    
                c.Add().Header(h => h.Text("Прикрепленные документы")).BodyTemplateId("attachments").ColSpan(25).RowSpan(1);
                c.Add().Header(h => h.Text("Рассылка")).BodyTemplateId("distributions").ColSpan(25).RowSpan(1);
            })
            .Reorderable()
            .Resizable()
            .Events(e=>e.Resize("onTileResize"))
            )

How put kendo template to js file and use in html

1

There are 1 best solutions below

0
rdmptn On

The following article is a detailed explanation of what you can do. Basically, put the templates in external files and load them as needed (say, with Ajax), and put them in the DOM. Make sure they are loaded before using them in a widget initialization though.

https://docs.telerik.com/kendo-ui/framework/templates/load-remote