I Am not sure if this can even be done, but from what I have read it should be. Since the Grid is not a form control, I should be able to use templates to generate the controls and have MVC generate the proper HTML when rendered. I started off using Dave Glick's "how to post data in a KendoUI grid in MVC https://daveaglick.com/posts/how-to-post-data-in-a-kendoui-grid I also used the Telerik Example at GitHub https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid/post-grid-with-form both were very helpful with getting a "first level" Grid to post data, however not for the Second Level.
So I am not even sure if this is possible, but I have what I think *should work) if I can get the data into the template and then on to the Grid. The first problem I am having is that I can't get any of the Grid Values in the Template for the 2nd level to "insert" I CAN get the #=WOID# to show but none of the others
#=GRIDID#
#=MAPNAME#
#=PAGENUMBER#
#=SCALE#
I am getting a JS error saying that GIDID is not defined. But WOID works and it's not defined.. what am I missing? Also when I just use the WOID and post data the posted data is not a collection, it is one record (only the WOID)
@using (Html.BeginForm("REREQUEST", "GridPrint")){@(Html.Kendo().Grid(new List<GRIDPRINTWO>()) //<GISPortal.GRIDPRINTWO>() .Name("grid") .Columns(columns => { columns.Bound(e => e.WOID).Width(40).Title("WO#"); columns.Bound(e => e.REQUESTDATE).Width(150).Format("{0:G}").Title("Date"); columns.Bound(e => e.REQUESTER).Width(100).Title("Requester#"); columns.Bound(e => e.NOTIFICATIONTYPE).Width(110).Title("Notification"); columns.Bound(e => e.COMPLETED).Width(110).Title("Completed?"); columns.Bound(e => e.ERRORS).Title("Errors?"); }) .Sortable() .Pageable() .Scrollable() .ClientDetailTemplateId("template") .HtmlAttributes(new { style = "height:600px;" }) .DataSource(dataSource => dataSource .Ajax() .Sort(sort => sort.Add("REQUESTDATE").Descending()) // <-- initial sort expression .PageSize(20) // .Read(read => read.Action("GRIDPRINTWO_Read", "Grid")) .Read(read => read.Action("GRIDPRINTWO_Read", "GridPrint", new { woid = ViewBag.woid, requester = ViewBag.requester })) ) .Events(events => events.DataBound("dataBound")) ) <script> var counter = 1; function gridIndex(data) { return counter++; } </script> <script> function index(dataItem) { var data = $("#Products").data("kendoGrid").dataSource.data(); return data.indexOf(dataItem); } </script><script id="template" type="text/kendo-tmpl"> @(Html.Kendo().Grid(new List<GRIDPRINTS>()) //<GISPortal.GRIDPRINTS>() .Name("grid_#=WOID#") // template expression, to be evaluated in the master context .Columns(columns => { columns.Bound(o => o.MAPNAME).Width(110).Title("Name"); columns.Bound(o => o.GRIDID).Width(110).Title("GridID"); columns.Bound(o => o.SCALE).Width(110).Title("Scale"); columns.Bound(o => o.PAGENUMBER).Title("PageNum"); columns.Bound(o => o.STATUS).Width(200).Title("Status"); columns.Bound(o => o.ERRORS).Width(300).Title("Errors?"); // shout out to daveaglick.com/posts/how-to-post-data-in-a-kendoui-grid // HERE IS WHERE I AM HAVING ISSUES columns.Bound(m => m.GRIDID).Hidden() .ClientTemplate("<input type='hidden' " + "name='THEGRIDID[#=gridIndex(data)#].GRIDID' " + "value='#=GRIDID#' />"); // ALSO TRIED THIS + "value='@item.GRIDID' />"); columns.Bound(m => m.MAPNAME).Hidden() .ClientTemplate("<input type='hidden' " + "name='THEMAPNAME[#=gridIndex(data)#].MAPNAME' " + "value='#=MAPNAME#' />"); columns.Bound(m => m.PAGENUMBER).Hidden() .ClientTemplate("<input type='hidden' " + "name='THEPAGENUMBER[#=gridIndex(data)#].PAGENUMBER' " + "value='#=PAGENUMBER#' />"); columns.Bound(m => m.SCALE).Hidden() .ClientTemplate("<input type='hidden' " + "name='THESCALE[#=gridIndex(data)#].SCALE' " + "value='#=SCALE#' />"); // JUST PLAYING HERE BUT THE WOID DOES WORK columns.Bound(o => o.MAPNAME).Width(110).Title("Re-Send") .ClientTemplate("<input type='checkbox' " + "name='CHECKED[#= WOID #].MAPNAME' " + "value='true' " + "#if (WOID) { #checked='checked'# } #/>" + "<input type='hidden' value='false' " + "name='themapname[#= WOID #].MAPNAME' />"); }) .DataSource(dataSource => dataSource .Ajax() .PageSize(10) .Read(read => read.Action("GRIDPRINTS_Read", "GridPrint", new { woid = "#=WOID#" })) .ServerOperation(false) ) .Pageable() .Sortable() .ToClientTemplate() )</script><script> function dataBound() { // this.expandRow(this.tbody.find("tr.k-master-row").first()); }</script> <input type="submit" value="SUBMIT" />}