RSS 2.0
Sign In
# Sunday, January 6, 2013

Kendo UI Docs contains an article "How To: Load Templates from External Files", where authors review two way of dealing with Kendo UI templates.

While using Kendo UI we have found our own answer to: where will the Kendo UI templates be defined and maintained?

solution tree

In our .NET project we have decided to keep templates separately, and to store them under the "templates" folder. Those templates are in fact include html, head, and stylesheet links. This is to help us to present those tempates in the design view.

In our scripts folder, we have defined a small text transformation template: "", which produces "templates.js" file. This template takes body contents of each "*.tmpl.html" file from "templates" folder and builds string of the form:

document.write('<script id="footer-template" type="text/x-kendo-template">...</script><script id="row-template" type="text/x-kendo-template">...</script>');

In our page that uses templates, we include "templates.js":

<!DOCTYPE html>
    <script src="scripts/templates.js"></script>

Thus, we have:

  • clean separation of templates and page content;
  • automatically generated templates include file. contains a web project demonstrating our technique. "" is text template transformation used in the project.

See also: Compile KendoUI templates.

Sunday, January 6, 2013 7:43:19 PM UTC  #    Comments [0] -
.NET | ASP.NET | javascript | Tips and tricks
Comments are closed.
<January 2013>
Total Posts: 387
This Year: 3
This Month: 1
This Week: 0
Comments: 947
Locations of visitors to this page
The opinions expressed herein are our own personal opinions and do not represent our employer's view in anyway.

© 2024, Nesterovsky bros
All Content © 2024, Nesterovsky bros
DasBlog theme 'Business' created by Christoph De Baene (delarou)