Kendo MVC - Child Grid - Client Tempate - Loading - Exception / Undefined

167 Views Asked by At

I getting exception for Expand child grid, When i add client template ProductId / ProductName exception.

columns.Bound(m => m.ProductId)
       .ClientTemplate("<a data-id='#=ProductId#'>#= ProductName #</a>");

Below code value is undefined,
columns.Bound(m => m.ProductId)
       .ClientTemplate("<a data-id='#=data.ProductId#'>#= data.ProductName #</a>");
1

There are 1 best solutions below

0
Thulasiram On BEST ANSWER

After continues effect, we found that it is retuning parent data item row.

Fix is to escape # by \\# in ClientTemplate.

columns.Bound(m => m.ProductId)
       .ClientTemplate("<a data-id='\\#=ProductId\\#'>\\#= ProductName \\#</a>");

// OR

columns.Bound(m => m.ProductId)
       .ClientTemplate("<a data-id='\\#=data.ProductId\\#'>\\#= data.ProductName \\#</a>");