is there a way to use the grid hierarchy to edit nested collections when you need the database generated ID to apply to the nested collection? I have the grids and controllers set up, but i don't know how to send the ID to the nested collection.
cshtml
@(Html.Kendo().Grid<DeploymentRequestV2>() .Name("DeploymentRequestGrid") .HtmlAttributes(new { style = "margin-top:10px" }) .Columns(col => { col.Bound(d => d.RequestId).Hidden(); col.Bound(d => d.DeploymentTitle); col.Bound(d => d.DeploymentId); col.Bound(d => d.ExtReqId); col.Bound(d => d.ElevatedUatApproval); col.Bound(d => d.PhaseId); col.Bound(d => d.DbaInstructions); col.Bound(d => d.Comments); //col.Bound(d => d.AttachmentFolderName); }) .ClientDetailTemplateId("RequestStepsSubScript") .DataSource(ds => ds .Ajax() .ServerOperation(true) .Model(m => { m.Id(d => d.RequestId); }) .Create("Create", "DeploymentRequestGrid") .Read("GetById", "DeploymentRequestGrid")) .Events(e=>e.DataBound("dataBound")) .Pageable() )</div><script id="RequestStepsSubScript" type="text/kendo-tmpl"> @(Html.Kendo().Grid<DeploymentRequestSteps>() .Name("grid_#=RequestId#") .Columns(col => { col.Bound(d => d.RequestStepId).Hidden(); col.ForeignKey(d => d.TypeId, (System.Collections.IEnumerable)ViewBag.ListOfDeploymentTypes, "TypeId", "DeploymentType1").Title("Type"); col.ForeignKey(d => d.DbserverId, (System.Collections.IEnumerable)ViewBag.ListOfDBServers, "DbserverId", "FriendlyName").Title("DatabaseServer"); col.Bound(d => d.SsrsReportFolder); col.ForeignKey(d => d.SsrsServerId, (System.Collections.IEnumerable)ViewBag.ListOfAllReportServers, "SsrsServerId", "SsrsServerName").Title("Ssrs Server"); col.Bound(d => d.IsComplete); col.Bound(d => d.ExecutionTimeOnDev); col.Bound(d => d.SourcePath).Hidden(); col.Bound(d => d.StepOrder).Hidden(); col.Bound(d => d.TfsMapId).Hidden(); col.Bound(d => d.ChangeSetId).Hidden(); col.Bound(d => d.CheckedInBy).Hidden(); col.Bound(d => d.CheckedInDate).Hidden(); col.Command(cmd => { cmd.Destroy(); }); }) .DataSource(ds => ds .Ajax() .Read(read => read.Action("GetById", "DeploymentRequestStepsSubGrid", new { id = "#=RequestId#" })) .Create(create=>create.Action("Create", "DeploymentRequestStepsSubGrid",new {id = "#=RequestId#" })) ) .Pageable() .Scrollable() .ToClientTemplate() )</script>parent grid read and create controller
public IActionResult GetById([DataSourceRequest]DataSourceRequest request, string id) { return Json(_context.DeploymentRequestV2.Where(x => x.RequestId.ToString() == id).ToDataSourceResult(request)); } public async Task<IActionResult> Create([DataSourceRequest]DataSourceRequest request, [Bind("DeploymentTitle", "DeploymentId", "ExtReqId", "ElevatedUatApproval", "DbaInstructions", "Comments", "AttachmentFolderName", "PhaseId", "RequestedBy", "RequestedDate")] DeploymentRequestV2 deploymentrequestv2) { try { if (ModelState.IsValid) { _context.Add(deploymentrequestv2); await _context.SaveChangesAsync(); ViewBag.RequestId = deploymentrequestv2.RequestId; int returnid = deploymentrequestv2.RequestId; return View(deploymentrequestv2); } } catch (DbUpdateException err) { ModelState.AddModelError("", "Unable to save changes to the request. " + err.InnerException); return View(); } return RedirectToAction(nameof(Index)); }child grid read and create controller
public IActionResult GetById([DataSourceRequest]DataSourceRequest request, string id) { return Json(_context.DeploymentRequestV2.Where(x => x.RequestId.ToString() == id).ToDataSourceResult(request)); } public async Task<IActionResult> Create([DataSourceRequest]DataSourceRequest request, [Bind("DeploymentTitle", "DeploymentId", "ExtReqId", "ElevatedUatApproval", "DbaInstructions", "Comments", "AttachmentFolderName", "PhaseId", "RequestedBy", "RequestedDate")] DeploymentRequestV2 deploymentrequestv2) { try { if (ModelState.IsValid) { _context.Add(deploymentrequestv2); await _context.SaveChangesAsync(); ViewBag.RequestId = deploymentrequestv2.RequestId; int returnid = deploymentrequestv2.RequestId; return View(deploymentrequestv2); } } catch (DbUpdateException err) { ModelState.AddModelError("", "Unable to save changes to the request. " + err.InnerException); return View(); } return RedirectToAction(nameof(Index)); }I feel like i'm close but can't quite get it working