I have defined external template and trying to use it in kendo as mentioned here
Howevere when page rendered i get error in kendo.all.min.js "0x800a138f - JavaScript runtime error: Unable to get property 'replace' of undefined or null reference". not sure what im doing wrong.
Also i'm passing ID's to javascript functions, i had to use single quote around ID's so cshtml wont show error, is that correct?
<
div
>
@(Html.Kendo().Grid<
Detail
>()
.Name("assetImportDetail")
.Columns(col =>
{
col.Bound(p => p.Cost);
col.Bound(p => p.Status);
col.Bound(p => p.FileName);
col.Bound(p => p.FileID).ClientTemplate("#=myTemplate(data)#").Title("Action");
})
.AutoBind(true)
.Pageable()
.Sortable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read
.Action("GetDetails", "MyDetail", new { ID = Model.ID })))
)
</
div
>
<
script
>
var myTemplate = kendo.template($('#actionTemplate').html());
</
script
>
<
script
id
=
"actionTemplate"
type
=
"text/x-kendo-template"
>
# if (Status == "Error") { #
<
button
class
=
"resolve-button"
onclick
=
"Download('#= ID1#','#= ID2#');"
>Resolve</
button
>
# } else if (Status == "Ready") { #
<
button
class
=
"approve-button"
onclick
=
"Approve('#= lID1 #');"
>Approve</
button
>
# } else if (Status == "Imported") { #
<
button
class
=
"remove-button"
onclick
=
"Remove('#= ID1 #','#= ID2#');"
>Remove</
button
>
#}#
</
script
>