Kendo UI Grid - Client Template: Escaping # sign

Mark

I'm working with Kendo UI's grid, along with Twitter Bootstrap.

Twitter Bootstrap has a built in pop-up/modal that can be called with:

<a href="#" class="text-yellow" data-toggle="modal" data-target="#login">Login</a>

In my Kendo UI grid, I have a custom column template:

   columns.Template(e => { }).ClientTemplate("<span data-toggle='modal' data-target='#login' title='Flag Animals as Dead or Deceased' style='cursor:pointer;' class='glyphicon glyphicon-flag flag-dead text-red'></span>").Width(50);

This is where I am having my issue, if you noticed, you need to specify the Id of the modal window with a # sign. ie data-target='#login'

Whenever the # sign is in my grid template, the grid breaks. How can I escape this sign?

cycopepe

You can escape # using \ character like this data-target='\#login'

UPDATE: From telerik documentation kendo templates

If your template includes a literal # character, which is not part of a binding expression and is not a script code marker, then you must escape that character or it will cause a template compilation error. For example, this can happen if a # is used inside a hyperlink URL or a CSS color value. Literal # in Javascript strings are escaped with \\#, while literal # in external HTML script templates are escaped with \#.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related