I am trying to use a edit command link for editing a row of kendo web ui grid. The problem is that I am not able to use the syntax "#= Id #", Id being defined as id in model and one of the fields. Here is the schema defined in datasource
var dataSource = new kendo.data.DataSource({
type: "json",
.....
schema: {
model: {
id: "Id",
fields: {
Id: { type: "number" },
RequesterName: { type: "string" },
...
}
},
data: "data",
total: "total"
},
...
pageSize: 5
});
And the kendo grid
$("#request-grid").kendoGrid({
dataSource: dataSource,
...
columns: [{
field: "Id", title: "Id", width: 35
}, {
field: "RequesterName", title: "Req Name", width: 175
}, {
...
}, {
command: [{ name: "edit", template: "<a href='@Url.Action("_SoftwareRequestEdit", "SoftwareRequest")" + "/#= Id #" + "'>Edit</a>" }]
}],
...
});
With the above code, when the grid loads I get following javascript error
ReferenceError: Id is not defined
#11 http://localhost:49713/Admin/SoftwareRequest/SoftwareRequestList:3
#10 http://localhost:49713/Scripts/Kendo/kendo.web.js:294:22 eval (eval at ()
#9 http://localhost:49713/Scripts/Kendo/kendo.web.js:26361:44 Widget.extend._createButton()
#8 http://localhost:49713/Scripts/Kendo/kendo.web.js:27571:38 Widget.extend._cellTmpl()
#7 http://localhost:49713/Scripts/Kendo/kendo.web.js:27523:41 Widget.extend._tmpl()
#6 http://localhost:49713/Scripts/Kendo/kendo.web.js:27624:37 Widget.extend._templates()
#5 http://localhost:49713/Scripts/Kendo/kendo.web.js:25055:18 new Widget.extend.init()
#4 http://localhost:49713/Scripts/Kendo/kendo.web.js:2785:25 HTMLDivElement.()
#3 http://localhost:49713/Scripts/jquery-2.1.0.js:381:23 Function.jQuery.extend.each()
#2 http://localhost:49713/Scripts/jquery-2.1.0.js:137:17 jQuery.fn.jQuery.each()
#1 http://localhost:49713/Scripts/Kendo/kendo.web.js:2784:26 $.fn.(anonymous function) [as kendoGrid]
As you can see, I have defined Id in the model, but I am still getting ReferenceError: Id is not defined. Any clues for the same.