This is a migrated thread and some comments may be shown as answers.
template syntax question
3 Answers 5 Views
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 27 Jan 2015, 04:21 PM
Hi,
I think this is a general question regarding template syntax.

I am trying to define a grid column template in a child grid template so that it is rendered as an anchor  (which I want to later use to re-position in the page). For example : 
<a href="#Myref1234">Bookmark</a>


In the column's ClientTemplate I have

.ClientTemplate("<a href='\\#\\#=Reference\\#'>Bookmark</a>")

But the result is an Invalid template
<a href='##=Reference#'>Bookmark</a>


This template without the leading \\# is accpeted and produces valid HTML:
.ClientTemplate("<a href='\\#=Reference\\#'>Bookmark</a>")


What syntax should I use to allow me to prefix the href with the # ?

Or perhaps you can suggest another way to allow me to reposition on the page?

Thanks
Craig

 

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 29 Jan 2015, 09:28 AM

Hello Craig,

The template should be as follows:

.ClientTemplate("<a href='\\\\\\#\\#=Reference\\#'>Bookmark</a>");

 

Regards,
Nikolay Rusev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Craig
Top achievements
Rank 1
answered on 29 Jan 2015, 09:41 AM
Hi Nikolay,
That works great.

What are the rules regarding the number of levels of escape characters (\\) to apply?

Craig
0
Nikolay Rusev
Telerik team
answered on 30 Jan 2015, 04:02 PM

Hello Craig,

Here is the idea behind all this - you need two back slashes \\ to escape hash # symbol in template. However as this template is inside another template (detail grid) you need two more backslashes \\, each of which is escaped with one more.

I hope this makes things a bit more clearer. 

Regards,
Nikolay Rusev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Asked by
Craig
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Craig
Top achievements
Rank 1
Share this question
or