Search code examples
kendo-gridkendo-asp.net-mvckendo-clienttemplate

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


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>");

Solution

  • 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>");