Template is not working with html encoded symbols (like ')

6 posts, 0 answers
  1. Volodymyr
    Volodymyr avatar
    11 posts
    Member since:
    May 2012

    Posted 10 Sep 2014 Link to this post


    I have MVC application that inserts some texts into the grid template.
    MVC encodes quotes (') to (') and it is fine but after that the template stops working!

    Here is an example: http://jsfiddle.net/GFV52/8/
    Why the template cannot work with html encoded symbols and how to fix this?

  2. Petyo
    Petyo avatar
    2440 posts

    Posted 11 Sep 2014 Link to this post


    the # symbols are expression delimiters. You should escape them with a \ prefix. Please refer to our documentation for more details. 

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Oleksandr
    Oleksandr avatar
    10 posts
    Member since:
    Oct 2008

    Posted 5 days and 7 hours ago Link to this post

    Hello Petyo,

    Don't you think that choosing '#' as expression delimiter for kendo templates was not the best idea? As Volodymyr pointed, this conflicts with HTML encoding.

    Many platforms do HTML encoding very simple (e.g in MVC I write @Localization.Get("aaa")). But I have to remember every time that it would have worked in regular HTML, and not in kendo template HTML. Kendo MVC seem to not have standard extension method for template-encoding (which is strange, although not hard to implement manually). But anyway syntax start looking weird and there is no way to simplify it:


    And this string must be copied again and again into every template, every server-included string. Crazy.

    It would make much less problems if you used different symbol ('$' maybe, or at least doubled '##'...). It would make situations, requiring additional encoding extreemely rare (although I understand it's not 100% reliable solution, but it's far better than current approach).

    Is there any chance you will change that in the near future (maybe support another template type "text/x-kendo-template2")?

    PS: You can imagine what would happen if my template is written inline in javascript piece inside razor view - 3rd encoding level...

  4. Oleksandr
    Oleksandr avatar
    10 posts
    Member since:
    Oct 2008

    Posted 4 days and 16 hours ago Link to this post

    I'm unable to edit my reply, so have to add another one to fix the bug (forgot Html encoding the string)...

    So, instead of writing 


    I have to use


    for every localization string I have in kendo templates (since any string may contain unicode characters in some language).

    If you had '##' or '$' as expression delimiter, simple @Localization.Get("aaa") would work in 99.9% of cases.

  5. Stefan
    Stefan avatar
    356 posts

    Posted 3 days and 14 hours ago Link to this post

    Hello Oleksandr,

    Thank you for your feedback.

    The suggestion is reasonable and valid, but changing the current behaviour of the templates will result in a major breaking change and changing it in the future is unlikely.

    Still, I will forward your request for making second type of templates which can use a different syntax.

    Also, I can suggest submitting a feature request in our UserVoice portal describing the request:


    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  6. Oleksandr
    Oleksandr avatar
    10 posts
    Member since:
    Oct 2008

    Posted 3 days and 7 hours ago in reply to Stefan Link to this post

    Hello Stefan,

    I actually added the suggestion on UserVoice portal yesterday, but it did not appear there till today. I tried again today, but now it says "You have been blocked" and does not allow to log in. My happiness of finally (after 2 years!) having all my forum posts not being considered as spam was short - I'm blocked now in another way :(.


    As for the topic, I think you actually could do a pretty reliable fix to current templates syntax as well - just not treat HTML-encoded symbols (regex '&#\d+;') as template delimiters.

    Having less conflicting template syntax text/x-kendo-template2 would still be a better solution, but for the time being the aforementioned fix is a must have.

    Could you log this request some where for me, or unblock my account please?

Back to Top