This is a migrated thread and some comments may be shown as answers.

#:Field# encoding doesn't work?

2 Answers 422 Views
Templates
This is a migrated thread and some comments may be shown as answers.
ExactBid
Top achievements
Rank 1
ExactBid asked on 10 Jan 2018, 08:09 PM

According to the Kendo UI template documentation, you can use either the #=Field# or #:Field# notation, with the #:Field# notation encoding the text. However, I cannot seem to get this to work.

I created a field in my model that just returned a string, "<b>Todd</b>". Then, I used the template like this:

<a href="/page.aspx?path=#=Field#"></a>

and also like this:

<a href="/page.aspx?path=#:Field#"></a>

In BOTH cases, the output was

<a href="/page.aspx?path=<b>Todd</b>"></a>

While I would expect that for the #=Field# notation, for the #:Field# notation, I was expecting:

<a href="/page.aspx?path=%3Cb%3ETodd%3C/b%3E"></a>

Any ideas on why this isn't working like I am expecting?

2 Answers, 1 is accepted

Sort by
0
Accepted
Plamen
Telerik team
answered on 12 Jan 2018, 12:08 PM
Hello,

This syntax will work correctly only for HTML encoding. In order to achieve your desired behavior you will have to use encodeURI as it is done for example in this dojo.

Regards,
Plamen
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
ExactBid
Top achievements
Rank 1
answered on 16 Jan 2018, 06:08 PM
Thanks.  That was what I was looking for.
Tags
Templates
Asked by
ExactBid
Top achievements
Rank 1
Answers by
Plamen
Telerik team
ExactBid
Top achievements
Rank 1
Share this question
or