I have created two views ​Shipment and Shipment Lines,
The Shipment has the header info, and of course the lines is the details. How do I have an action link form the parent grid to the child view, and pass the correct order Id (the model) to the line read action?
This is the Shipment View:
@(Html.Kendo().Grid<Portal.Model.DAX.PurchaseShipment>() .Name("Grid") .Columns(columns => { columns.Bound(c => c.CompanyId).Width(160); columns.Bound(c => c.VendAccount).Width(120) columns.Bound(c => c.DeliveryMode).Width(120); columns.Bound(c => c.VendShipId).Width(120); columns.Bound(c => c.ShipmentDate).Width(140).Format("{0:MM/dd/yy}"); columns.Bound(c => c.EstimateShipmentDate).Width(140).Format("{0:MM/dd/yy}"); columns.Bound(c => c.SourceOfData).Hidden(true).IncludeInMenu(false); columns.Bound(c => c.RecVersion).Title("Rec Version").Hidden(true).IncludeInMenu(false); columns.Bound(c => c.RecId).Title("RecId").Hidden(true).IncludeInMenu(false); columns.Bound(c => c.CompanyId).ClientTemplate(@Html.ActionLink("Lines", "Lines", "Shipment", new { CompanyId = "#=CompanyId#", RecId = "#=RecId#" }, "").ToHtmlString()).Width(120); columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180); }) .ToolBar(toolbar => { toolbar.Create().Text("Add Shipment").HtmlAttributes(new { @title = "Add Shipment" }); toolbar.Excel(); }) .Editable(editable => editable.Mode(GridEditMode.PopUp)) .DataSource(dataSource => dataSource .Ajax() .PageSize(20) .Model(model => model.Id(p => p.CompanyId)) .Read(read => read.Action("Read", "Shipment").Type(HttpVerbs.Post)) .Create(create => create.Action("Create", "Shipment").Type(HttpVerbs.Post)) .Update(update => update.Action("Update", "Shipment").Type(HttpVerbs.Post)) .Destroy(destroy => destroy.Action("Destroy", "Shipment")) ) )And the Lines View: (I know the model has the PurchaseShipment data, I had textboxes populating it for testing)
@using Portal.Model.DAX@model PurchaseShipment @(Html.Kendo().Grid<Portal.Models.ShipmentLinesViewModel>() .Name("grid") .Columns(columns => { columns.Bound(c => c.CompanyId); columns.Bound(c => c.ShipId); columns.Bound(c => c.PurchId); columns.Bound(c => c.PurchaseOrderId); columns.Bound(c => c.PurchaseOrderDate); columns.Bound(c => c.InventTransId); columns.Bound(c => c.LineNum); columns.Bound(c => c.ItemId); columns.Bound(c => c.UnitId); columns.Bound(c => c.QuantityOrdered); columns.Bound(c => c.QuantityShipped); columns.Bound(c => c.RecVersion); columns.Bound(c => c.RecId); columns.Command(command => { command.Edit(); }).Width(180); }) .ToolBar(toolbar => { toolbar.Excel(); }) .Editable(editable => editable.Mode(GridEditMode.InLine)) .Pageable() .Sortable(sortable => { sortable.SortMode(GridSortMode.MultipleColumn); }) .Filterable() .Scrollable() .DataSource(dataSource => dataSource .Ajax() .Model(model => model.Id(p => p.CompanyId)) .Read(read => read.Action("Lines_Read", "Shipment")) .Update(update => update.Action("Lines_Update", "Shipment")) ) )
So the issue is that when the read for the lines happens it doesn't have the Shipment Model available so I can grab the correct line data. How do I pass from one view to the next, and pass the model to the read action?