Hello,
I am having an issue accessing a field that exists in the model for the clientdetailtemplate it keeps searching the parent grids model and not the clientdetail:
below in the template grid the line columns.Bound(c => c.PurchaseOrder).ClientTemplate("<button class='k-button' onclick=\"showDetails('#=PurchaseOrder#','#=DC#')\">Item Details</button>").Title("Item Details"); fails with "Uncaught ReferenceError: DC is not defined" but i can swith DC in that line to PODateShort and it send that number to the onclick function. so im assuming that #=field# can only reference the main grids model but i need to get the DC from the secondary grid so that i can send that to the onclick and search for all the items in that po for that dc.
Any help would be greatly appreciated.
@(Html.Kendo().Grid<PurchaseOrderResults>()
.Name("POGrid")
.Resizable(resize => resize.Columns(true))
.Reorderable(reorder => reorder.Columns(true))
.Filterable()
.HtmlAttributes(new { style = "height:600px;" })
.Columns(columns =>
{
columns.Bound(c => c.PurchaseOrder);
columns.Bound(c => c.PODateShort);
columns.Bound(c => c.RequestDateShort);
columns.Bound(c => c.ActualShipDateShort);
columns.Bound(c => c.ArrivalDateShort);
})
.Scrollable()
.ClientDetailTemplateId("POtemplate")
.Sortable()
.Pageable(builder => builder.PageSizes(new[] { 10, 50, 100 }))
.DataSource(datasource => datasource
.Ajax()
.PageSize(10)
.Read(read => read.Action("GetPOSearch", "PO", new { SiteID = Model.SiteID, PONumbers = Model.PONumbers }))
)
)
</div>
<script id="POtemplate" type="text/kendo-tmpl">
@(Html.Kendo().Grid<PurchaseOrderDCResults>()
.Name("POGrid_#=PurchaseOrder#") // template expression, to be evaluated in the master context
.Columns(columns =>
{
columns.Bound(c => c.PurchaseOrder);
columns.Bound(c => c.DC);
columns.Bound(c => c.OrderDollars);
columns.Bound(c => c.UnitsOrdered);
columns.Bound(c => c.PurchaseOrder).ClientTemplate("<button class='k-button' onclick=\"showDetails('#=PurchaseOrder#','#=DC#')\">Item Details</button>").Title("Item Details");
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Read(read => read.Action("GetPODCSearch", "PurchaseOrder", new { SiteID = Model.SiteID, PONumber = "#=PurchaseOrder#" }))
)
.Pageable(builder => builder.PageSizes(new[] { 10, 50, 100 }))
.Sortable()
.ToClientTemplate()
)
</script>