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

&#x in editor template template

3 Answers 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dina
Top achievements
Rank 1
Dina asked on 20 Dec 2016, 02:05 PM

When I use national symbols text in editor template I got Invalid template due to # in template

 

mean

@Html.Kendo().TextBoxFor(m => m.Number)

in editor template transformed to

<input class="k-textbox" data-val="true" data-val-required="&#x423;&#x43A;&#x430;&#x436;&#x438;&#x442;&#x435; &#x43D;&#x43E;&#x43C;&#x435;&#x440; &#x43A;&#x432;&#x430;&#x440;&#x442;&#x438;&#x440;&#x44B;" id="Number" name="Number" value="" />' Generated code:'var $kendoOutput, $kendoHtmlEncode = kendo.htmlEncode;with(data){$kendoOutput='<input class="k-textbox" data-val="true" data-val-required="&';x423;&;$kendoOutput+='x43A;&';x430;&;$kendoOutput+='x436;&';x438;&;$kendoOutput+='x442;&';x435; &;$kendoOutput+='x43D;&';x43E;&;$kendoOutput+='x43C;&';x435;&;$kendoOutput+='x440; &';x43A;&;$kendoOutput+='x432;&';x430;&;$kendoOutput+='x440;&';x442;&;$kendoOutput+='x438;&';x440;&;$kendoOutput+='x44B;" id="Number" name="Number" value="" />';}return $kendoOutput;

and generate template error due to #

3 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 23 Dec 2016, 10:58 AM
Hello Dima,

When there are "#" symbols in the template you need to ensure that they are escaped. Check out the article below that describes the approach in more detail.



Regards,
Viktor Tachev
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.
0
Dina
Top achievements
Rank 1
answered on 23 Dec 2016, 11:42 AM

Hi Viktor

@Html.Kendo().TextBoxFor(m => m.Number).ToClientTemplate() works. tnks

But anyway this situation makes it impossible to use kendo  grid and national symbols in model display template like

        [Display(Name = "Сообщение")]
        public string Text { get; set; }

If you have model like this standard editor template by kendo will produce template error

 

In this case you to workaround this by making your own editor template

also I do have a  problem with my editor templates as I cannot find proper substitute of @Html.LabelFor(m=>m.Number)

as @Html.LabelFor does not support  .ToClientTemplate()  and  generates  hashes

 

can you please advise me  on how to add label instead  of

@Html.LabelFor(m=>m.Number)

PS

<label for="Number">Номер</label>

works but I rather use no custom editor at all(most cases) or use LabelFor

0
Viktor Tachev
Telerik team
answered on 27 Dec 2016, 12:04 PM
Hello Dima,

Would you assemble a small sample where the behavior you are seeing is replicated? This way we can examine the code and look for what is causing the behavior you are seeing.


Regards,
Viktor Tachev
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.
Tags
Grid
Asked by
Dina
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Dina
Top achievements
Rank 1
Share this question
or