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

Microsoft JScript runtime error: Invalid template:

1 Answer 155 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ravi
Top achievements
Rank 1
Ravi asked on 09 Oct 2012, 10:46 AM
Hello,

When I am binding the dynamic dataset (columns can be 25-30 based on request) to Kendo Grid, I am getting this error at the runtime. Could anyone tell me how to solve this error. I dont have any null column header.

Error :

Microsoft JScript runtime error: Invalid template:'<tr data-uid="#=uid#"><td >${Category}</td><td >${ProductID}</td><td >${CurrencyCode}</td><td >${ISIN}</td><td >${CUSIP}</td><td >${IDC Price}</td><td >${IDC Date}</td><td >${JPM Price}</td><td >${JPM Date}</td><td >${BARC Price}</td><td >${BARC Date}</td><td >${GoldSachs Price}</td><td >${GoldSachs Date}</td><td >${BofA Price}</td><td >${BofA Date}</td><td >${MorStan Price}</td><td >${MorStan Date}</td><td >${CITI Price}</td><td >${CITI Date}</td><td >${Add. Broker Price}</td><td >${Add. Broker Date}</td><td >${Add. Broker Source}</td><td >${Gifford Price}</td><td >${Gifford Date}</td><td >${Purchase Price}</td><td >${Purchase Date}</td><td >${AmortCost Price}</td><td >${AmortCost Date}</td><td >${Master OW Price}</td><td >${Master OW Date}</td><td >${Determined Price}</td><td >${Determined Date}</td><td >${Determined Remarks}</td><td >${ModelID}</td></tr>' Generated code:'var o,e=kendo.htmlEncode;with(data){o='<tr data-uid="'+(uid)+'"><td >'+(e(Category))+'</td><td >'+(e(ProductID))+'</td><td >'+(e(CurrencyCode))+'</td><td >'+(e(ISIN))+'</td><td >'+(e(CUSIP))+'</td><td >'+(e(IDC Price))+'</td><td >'+(e(IDC Date))+'</td><td >'+(e(JPM Price))+'</td><td >'+(e(JPM Date))+'</td><td >'+(e(BARC Price))+'</td><td >'+(e(BARC Date))+'</td><td >'+(e(GoldSachs Price))+'</td><td >'+(e(GoldSachs Date))+'</td><td >'+(e(BofA Price))+'</td><td >'+(e(BofA Date))+'</td><td >'+(e(MorStan Price))+'</td><td >'+(e(MorStan Date))+'</td><td >'+(e(CITI Price))+'</td><td >'+(e(CITI Date))+'</td><td >'+(e(Add. Broker Price))+'</td><td >'+(e(Add. Broker Date))+'</td><td >'+(e(Add. Broker Source))+'</td><td >'+(e(Gifford Price))+'</td><td >'+(e(Gifford Date))+'</td><td >'+(e(Purchase Price))+'</td><td >'+(e(Purchase Date))+'</td><td >'+(e(AmortCost Price))+'</td><td >'+(e(AmortCost Date))+'</td><td >'+(e(Master OW Price))+'</td><td >'+(e(Master OW Date))+'</td><td >'+(e(Determined Price))+'</td><td >'+(e(Determined Date))+'</td><td >'+(e(Determined Remarks))+'</td><td >'+(e(ModelID))+'</td></tr>';}return o;'


Regards,
Ravi

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 09 Oct 2012, 01:01 PM
Hello Ravi,

You can't have field names with spaces or other characters that are not valid to be used in Javascript variables, as seen in the generated template function after the error message.

In addition, please avoid posting duplicate forum threads.

Regards,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Ravi
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or