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

"Invalid template" when initializing grid

6 Answers 3789 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Khalid Dermoumi
Top achievements
Rank 1
Khalid Dermoumi asked on 10 Mar 2012, 01:58 AM

Hi!

Im getting an "invalid template" exception when initializing a grid.

This is the JS code:

jQuery("#uipoc_readwrite_messagelist_table").kendoGrid();

This is the complete exception message:

Invalid template:'<tr><td>#=Betreff#</td><td>#=Absender#</td><td>#=Erhalten#</td><td>#=#</td><td>#=#</td></tr>' Generated code:'var o,e=kendo.htmlEncode;with(data){o='<tr><td>'+(Betreff)+'</td><td>'+(Absender)+'</td><td>'+(Erhalten)+'</td><td>'+()+'</td><td>'+()+'</td></tr>';}return o;'

This is the html at the time the code is executed:

<TABLE id=uipoc_readwrite_messagelist_table>
<THEAD>
<TR>
<TH>Betreff</TH>
<TH>Absender</TH>
<TH>Erhalten</TH>
<TH></TH>
<TH></TH></TR></THEAD>
<TBODY>
<TR>
<TD><A id=uipoc_readwrite_messagelist_b0ca6719-1984-4f3f-8be4-9d4c5eaba774 href="#uipoc_readwrite_messagelist_b0ca6719-1984-4f3f-8be4-9d4c5eaba774" jQuery171046139815295798753="5">dad about ship hot light ill keys something smoke

something</A></TD>
<TD>Karen Mayer</TD>
<TD>07.02.2012 02:58:22</TD>
<TD><BUTTON id=uipoc_readwrite_messagelist_answerMessage_b0ca6719-1984-4f3f-8be4-9d4c5eaba774 type=button jQuery171046139815295798753="6">Antworten</BUTTON></TD>
<TD></TD></TR>
<TR>
<TD><A id=uipoc_readwrite_messagelist_08dda71c-e777-4436-82c8-634a779bfed0 href="#uipoc_readwrite_messagelist_08dda71c-e777-4436-82c8-634a779bfed0" jQuery171046139815295798753="7">out worn wicket on generated rabbit many ball to

rescue</A></TD>
<TD>Karen Mayer</TD>
<TD>09.03.2012 20:50:01</TD>
<TD><BUTTON id=uipoc_readwrite_messagelist_answerMessage_08dda71c-e777-4436-82c8-634a779bfed0 type=button jQuery171046139815295798753="8">Antworten</BUTTON></TD>
<TD></TD></TR>
<TR>
<TD><A id=uipoc_readwrite_messagelist_e7d8b8f6-708d-4547-bd31-8c05d3be2a2e href="#uipoc_readwrite_messagelist_e7d8b8f6-708d-4547-bd31-8c05d3be2a2e" jQuery171046139815295798753="9">library are words always plane days to computer

will</A></TD>
<TD>Lindsey Craft</TD>
<TD>11.01.2012 14:40:45</TD>
<TD><BUTTON id=uipoc_readwrite_messagelist_answerMessage_e7d8b8f6-708d-4547-bd31-8c05d3be2a2e type=button jQuery171046139815295798753="10">Antworten</BUTTON></TD>
<TD></TD></TR>
<TR>
<TD><A id=uipoc_readwrite_messagelist_5e64f31f-9cf1-413f-ae47-33816435e655 href="#uipoc_readwrite_messagelist_5e64f31f-9cf1-413f-ae47-33816435e655" jQuery171046139815295798753="11">smoke much many window this text of suspense died

of</A></TD>
<TD>Karen Mayer</TD>
<TD>17.12.2011 17:26:42</TD>
<TD><BUTTON id=uipoc_readwrite_messagelist_answerMessage_5e64f31f-9cf1-413f-ae47-33816435e655 type=button jQuery171046139815295798753="12">Antworten</BUTTON></TD>
<TD></TD></TR>
<TR>
<TD><A id=uipoc_readwrite_messagelist_eb2b1d0b-6071-456b-a675-bed1a3055fd6 href="#uipoc_readwrite_messagelist_eb2b1d0b-6071-456b-a675-bed1a3055fd6" jQuery171046139815295798753="13">rescue asked leader pique to handled always

captain</A></TD>
<TD>Chasity Conway</TD>
<TD>03.03.2012 19:41:40</TD>
<TD><BUTTON id=uipoc_readwrite_messagelist_answerMessage_eb2b1d0b-6071-456b-a675-bed1a3055fd6 type=button jQuery171046139815295798753="14">Antworten</BUTTON></TD>
<TD></TD></TR>
<TR>
<TD><A id=uipoc_readwrite_messagelist_311625ac-6b95-4c35-a6e0-79dbad0f62b3 href="#uipoc_readwrite_messagelist_311625ac-6b95-4c35-a6e0-79dbad0f62b3" jQuery171046139815295798753="15">others had constantly smoke will should worn when

ending</A></TD>
<TD>Nancy Stevens</TD>
<TD>18.02.2012 07:47:57</TD>
<TD><BUTTON id=uipoc_readwrite_messagelist_answerMessage_311625ac-6b95-4c35-a6e0-79dbad0f62b3 type=button jQuery171046139815295798753="16">Antworten</BUTTON></TD>
<TD></TD></TR></TBODY></TABLE>

6 Answers, 1 is accepted

Sort by
0
Alexis
Top achievements
Rank 1
answered on 27 Mar 2012, 02:14 AM
Any replies? I also have the same problem. I'm using kendo ui grid, backbone, underscore and require.js

'Error: Invalid template:'<tr><td>${ItemDescription}</td><td>${Qty}</td><td>${Unit Price}</td><td>${Extended Price}</td></tr>' Generated code:'var o,e=kendo.htmlEncode;with(data){o='<tr><td>'+(e(ItemDescription))+'</td><td>'+(e(Qty))+'</td><td>'+(e(Unit Price))+'</td><td>'+(e(Extended Price))+'</td></tr>';}return o;'' when calling method: [nsIDOMEventListener::handleEvent]

Filtered chrome url chrome://firebug/content/net/spy.js

#Update

anyway i solved it. It seems like when setting up columns for the grid it doesn't accept spaces. Is this a bug?
0
johnny young
Top achievements
Rank 1
answered on 03 Oct 2012, 03:42 PM
is no a bug, just attribute "field" is a without space, "title" if accept space.

last comment solved the error.

thanks ;)
0
Robbie
Top achievements
Rank 1
answered on 04 Jan 2016, 02:37 AM

I am also receiving a similar error: 

Uncaught Error: Invalid template:'<tr data-uid="#=data.uid#" role='row'><td  role='gridcell'>#=data.eSpacelnkSortRichWidgets_List_SortColumnEspace[Name]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt62_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt62_block_wttxtTableRecordsId==null?'':data.eSpacelnkSortRichWidgets_List_SortColumnEspace[Name]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt62_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt62_block_wttxtTableRecordsId#</td><td  role='gridcell'>#=data.UploadedBylnkSortRichWidgets_List_SortColumnUser[Name]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt36_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt36_block_wttxtTableRecordsId==null?'':data.UploadedBylnkSortRichWidgets_List_SortColumnUser[Name]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt36_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt36_block_wttxtTableRecordsId#</td><td  role='gridcell'>#=data.UploadedDatelnkSortRichWidgets_List_SortColumnEspace_Version[Uploaded_Date]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt22_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt22_block_wttxtTableRecordsId==null?'':data.UploadedDatelnkSortRichWidgets_List_SortColumnEspace_Version[Uploaded_Date]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt22_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt22_block_wttxtTableRecordsId#</td><td  role='gridcell'>#=data.ValidlnkSortRichWidgets_List_SortColumnEspace_Version[Is_Valid]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt29_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt29_block_wttxtTableRecordsId==null?'':data.ValidlnkSortRichWidgets_List_SortColumnEspace_Version[Is_Valid]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt29_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt29_block_wttxtTableRecordsId#</td><td  role='gridcell'>#=data.ServiceStudioVersionlnkSortRichWidgets_List_SortColumnEspace_Version[Service_Studio_Version]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt4_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt4_block_wttxtTableRecordsId==null?'':data.ServiceStudioVersionlnkSortRichWidgets_List_SortColumnEspace_Version[Service_Studio_Version]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt4_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt4_block_wttxtTableRecordsId#</td><td  role='gridcell'>#=data.LastUpgradeVersionlnkSortRichWidgets_List_SortColumnEspace_Version[Last_Upgrade_Version]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt6_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt6_block_wttxtTableRecordsId==null?'':data.LastUpgradeVersionlnkSortRichWidgets_List_SortColumnEspace_Version[Last_Upgrade_Version]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt6_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt6_block_wttxtTableRecordsId#</td><td  role='gridcell'>#=data.BasedOnPreviouslnkSortRichWidgets_List_SortColumnEspace_Version[Based_On_Previous]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt56_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt56_block_wttxtTableRecordsId==null?'':data.BasedOnPreviouslnkSortRichWidgets_List_SortColumnEspace_Version[Based_On_Previous]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt56_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt56_block_wttxtTableRecordsId#</td></tr>' Generated code:'var $kendoOutput, $kendoHtmlEncode = kendo.htmlEncode;with(data){$kendoOutput='<tr data-uid="'+(data.uid)+'" role=\'row\'><td  role=\'gridcell\'>'+(data.eSpacelnkSortRichWidgets_List_SortColumnEspace[Name]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt62_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt62_block_wttxtTableRecordsId==null?'':data.eSpacelnkSortRichWidgets_List_SortColumnEspace[Name]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt62_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt62_block_wttxtTableRecordsId)+'</td><td  role=\'gridcell\'>'+(data.UploadedBylnkSortRichWidgets_List_SortColumnUser[Name]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt36_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt36_block_wttxtTableRecordsId==null?'':data.UploadedBylnkSortRichWidgets_List_SortColumnUser[Name]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt36_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt36_block_wttxtTableRecordsId)+'</td><td  role=\'gridcell\'>'+(data.UploadedDatelnkSortRichWidgets_List_SortColumnEspace_Version[Uploaded_Date]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt22_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt22_block_wttxtTableRecordsId==null?'':data.UploadedDatelnkSortRichWidgets_List_SortColumnEspace_Version[Uploaded_Date]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt22_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt22_block_wttxtTableRecordsId)+'</td><td  role=\'gridcell\'>'+(data.ValidlnkSortRichWidgets_List_SortColumnEspace_Version[Is_Valid]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt29_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt29_block_wttxtTableRecordsId==null?'':data.ValidlnkSortRichWidgets_List_SortColumnEspace_Version[Is_Valid]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt29_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt29_block_wttxtTableRecordsId)+'</td><td  role=\'gridcell\'>'+(data.ServiceStudioVersionlnkSortRichWidgets_List_SortColumnEspace_Version[Service_Studio_Version]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt4_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt4_block_wttxtTableRecordsId==null?'':data.ServiceStudioVersionlnkSortRichWidgets_List_SortColumnEspace_Version[Service_Studio_Version]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt4_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt4_block_wttxtTableRecordsId)+'</td><td  role=\'gridcell\'>'+(data.LastUpgradeVersionlnkSortRichWidgets_List_SortColumnEspace_Version[Last_Upgrade_Version]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt6_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt6_block_wttxtTableRecordsId==null?'':data.LastUpgradeVersionlnkSortRichWidgets_List_SortColumnEspace_Version[Last_Upgrade_Version]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt6_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt6_block_wttxtTableRecordsId)+'</td><td  role=\'gridcell\'>'+(data.BasedOnPreviouslnkSortRichWidgets_List_SortColumnEspace_Version[Based_On_Previous]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt56_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt56_block_wttxtTableRecordsId==null?'':data.BasedOnPreviouslnkSortRichWidgets_List_SortColumnEspace_Version[Based_On_Previous]BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt56_block_wtlnkSortespacesBootstrapT_Sky_wt69_block_wtMainContent_wtEspaceVersionTableEspace_Version[Service_Studio_Version]DESCespaces2User[Name]ASCespaces2BootstrapT_Sky_wt67_block_wtMainContent_wtEspaceVersionTable_ctl02_RichWidgets_wt56_block_wttxtTableRecordsId)+'</td></tr>';}return $kendoOutput;'
VM5606:545 Detected Kendo UI version: "2015.1.616"

 

Any help would be appreciated. Thanks.

0
Alexander Valchev
Telerik team
answered on 07 Jan 2016, 08:40 AM
Hello Robbie,

Most probably you have not escaped hash literal (#). Check this help topic to learn how to escape the symbol. Usually (#) is used in href attributes and CSS color styles.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Gino
Top achievements
Rank 1
answered on 29 Jun 2017, 08:08 AM

Please help me I am getting the same issue here. It is just a very simple JSON structure.

Uncaught Error: Invalid template:'<tr data-uid="#=data.uid#" role='row'><td  role='gridcell'>#:data.Till==null?'':data.Till#</td><td  role='gridcell'>#:data.1p==null?'':data.1p#</td><td  role='gridcell'>#:data.2p==null?'':data.2p#</td><td  role='gridcell'>#:data.5p==null?'':data.5p#</td><td  role='gridcell'>#:data.10p==null?'':data.10p#</td><td  role='gridcell'>#:data.20p==null?'':data.20p#</td><td  role='gridcell'>#:data.50p==null?'':data.50p#</td><td  role='gridcell'>#:data.£1==null?'':data.£1#</td><td  role='gridcell'>#:data.£2==null?'':data.£2#</td><td  role='gridcell'>#:data.£5==null?'':data.£5#</td><td  role='gridcell'>#:data.£10==null?'':data.£10#</td><td  role='gridcell'>#:data.£20==null?'':data.£20#</td><td  role='gridcell'>#:data.£50==null?'':data.£50#</td></tr>' Generated code:'var $kendoOutput, $kendoHtmlEncode = kendo.htmlEncode;with(data){$kendoOutput='<tr data-uid="'+(data.uid)+'" role=\'row\'><td  role=\'gridcell\'>'+$kendoHtmlEncode(data.Till==null?'':data.Till)+'</td><td  role=\'gridcell\'>'+$kendoHtmlEncode(data.1p==null?'':data.1p)+'</td><td  role=\'gridcell\'>'+$kendoHtmlEncode(data.2p==null?'':data.2p)+'</td><td  role=\'gridcell\'>'+$kendoHtmlEncode(data.5p==null?'':data.5p)+'</td><td  role=\'gridcell\'>'+$kendoHtmlEncode(data.10p==null?'':data.10p)+'</td><td  role=\'gridcell\'>'+$kendoHtmlEncode(data.20p==null?'':data.20p)+'</td><td  role=\'gridcell\'>'+$kendoHtmlEncode(data.50p==null?'':data.50p)+'</td><td  role=\'gridcell\'>'+$kendoHtmlEncode(data.£1==null?'':data.£1)+'</td><td  role=\'gridcell\'>'+$kendoHtmlEncode(data.£2==null?'':data.£2)+'</td><td  role=\'gridcell\'>'+$kendoHtmlEncode(data.£5==null?'':data.£5)+'</td><td  role=\'gridcell\'>'+$kendoHtmlEncode(data.£10==null?'':data.£10)+'</td><td  role=\'gridcell\'>'+$kendoHtmlEncode(data.£20==null?'':data.£20)+'</td><td  role=\'gridcell\'>'+$kendoHtmlEncode(data.£50==null?'':data.£50)+'</td></tr>';}return $kendoOutput;'

0
Stefan
Telerik team
answered on 04 Jul 2017, 06:37 AM

Hello Gino,

This error can usually be caused by the following:

- mismatching opening and closing code block characters (#) inside the template declaration
- using a # character as a literal without escaping it with backslashes
- nesting Kendo UI templates, which brings the need to escape non-literal # characters in the inner template, in order to "hide" them from the outer template

These possible issues are discussed on the following page:

http://docs.telerik.com/kendo-ui/framework/templates/overview

I can also suggest removing parts of the used template to determine which one is causing the issue.

If additional assistance is needed, please provide the template so we can inspect it locally and determine what may be causing the issue.

Regards,
Stefan
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Chris
Top achievements
Rank 1
Iron
commented on 05 Oct 2021, 04:20 PM

I encountered a similar error with the Kendo UI MVC Grid when the ClientTemplate was specified after the EditorTemplateName 

The following will throw the error:

@(Html.Kendo().Grid(Model.BillOfMaterialItems)
            .Name("BillOfMaterialsGrid")
            .Columns(columns =>
            {
                columns.Bound(o => o.UnitOfMeasure).Width(200).Title("Unit")
                    .HeaderHtmlAttributes(new { @style = "text-align:left;" })
                    .HtmlAttributes(new { style = "text-align:left;" })
                    .EditorTemplateName("UnitOfMeasureDropDownList")
                    .EditorViewData(new { Units = Model.CurrentUnits })
                    .ClientTemplate("#:UnitOfMeasure.UomDisplayName#");
                   // etc

but putting the ClientTemplate before the EditorTemplateName eliminates the error:

        @(Html.Kendo().Grid(Model.BillOfMaterialItems)
            .Name("BillOfMaterialsGrid")
            .Columns(columns =>
            {
                columns.Bound(o => o.UnitOfMeasure).Width(200).Title("Unit")
                    .HeaderHtmlAttributes(new { @style = "text-align:left;" })
                    .HtmlAttributes(new { style = "text-align:left;" })
                    .ClientTemplate("#:UnitOfMeasure.UomDisplayName#")//NOTE: this must be declared before EditorTemplateName and EditorViewData.
                    .EditorTemplateName("UnitOfMeasureDropDownList")
                    .EditorViewData(new { Units = Model.CurrentUnits });
                    // etc

where the UnitOfMeasureDropDownList.cshtml file is placed in MVC project /Views/Shared/EditorTemplates and is specified as follows:


@model App.Common.POCO.Generated.Procedures.Athena.UnitOfMeasureDataSource
@{
    // Access the actual parameter values anywhere including the kendo helpers below (if any) via ViewData:
    var units = (int)ViewData["Units"];
}
@(
    Html.Kendo().DropDownListFor(m => m)
        .DataTextField("UomName")
        .DataValueField("UomId")
        .HtmlAttributes(new {@style = "width: 200px;"})
        .OptionLabel("Select Unit of Measure...")
        .DataSource(source =>
        {
            source.Read(read =>
            {
                read.Action("UnitOfMeasureDataSource", "DataSource", new { @area = "Helpers", @units=units });
            })
            .ServerFiltering(true);
        })
        .Enable(true)
        .AutoBind(true)
)

Anton Mironov
Telerik team
commented on 08 Oct 2021, 01:14 PM

Hi Chris,

Thank you for sharing your approach with the community.

Could you please confirm that the ClientTemplate is working as expected? The recommended syntax is "#=Model.PropertyName#" as in the following demo:

Kind Regards,
Anton Mironov

Chris
Top achievements
Rank 1
Iron
commented on 08 Oct 2021, 01:50 PM

Hi Anton.  Yes it is working fine.

Cheers,
Chris

Tags
Grid
Asked by
Khalid Dermoumi
Top achievements
Rank 1
Answers by
Alexis
Top achievements
Rank 1
johnny young
Top achievements
Rank 1
Robbie
Top achievements
Rank 1
Alexander Valchev
Telerik team
Gino
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or