- Home
- Forum
- ASP.NET Core - EJ 2
- Child grid ( primary key from parent grid is null)
Child grid ( primary key from parent grid is null)
Hi, can I know why i get null value of ID from parent grid when I click edit button? *picture below for reference

function actionBeginVehicle(e) { // childGrid actionBegin event
var grid = document.getElementsByClassName("e-grid")[0].ej2_instances[0]; //parent grid
var childGrid = document.getElementById("childGrid").ej2_instances[0]; //child grid
alert(e.requestType);
if (e.requestType == "beginEdit" ) {
childGrid.query.addParams("driver_id", grid.getSelectedRecords()[0].driver_id);
}
else if (e.requestType == "save" && e.action == "add") {
childGrid.query.addParams("driver_id", grid.getSelectedRecords()[0].driver_id);
childGrid.refresh();
}
}
Controller
public IActionResult UpdateVehicle([FromBody] CustomCRUDModel<VehicleDetails> value)
{
VehicleDetails result = new VehicleDetails();
result.driver_id = value.Params.driver_id;
result.id = value.Value.id;
result.plateno = value.Value.plateno;
result.carmodel = value.Value.carmodel;
result.carbrand = value.Value.carbrand;
result.carcolor = value.Value.carcolor;
result.year = value.Value.year;
//result.servicetype = value.Value.servicetype;
result = new DriverDAL().EditVehicle(result);
string msg = "Update";
return Json(new { data = result, message = msg });
//return Json(result);
}
public class CustomCRUDModel<T> where T : class
{
public string Action { get; set; }
public string Table { get; set; }
public string KeyColumn { get; set; }
public object Key { get; set; }
public T Value { get; set; }
public List<T> Added { get; set; }
public List<T> Changed { get; set; }
public List<T> Deleted { get; set; }
public VehicleDetails Params { get; set; }
public Attachment ParamsAtt { get; set; }
}
SIGN IN To post a reply.
1 Reply
PK
Prasanna Kumar Viswanathan
Syncfusion Team
January 10, 2020 10:27 AM UTC
Hi Muhamad,
Thanks for contacting Syncfusion support.
Based on your query you need to get the value of an ID from parent grid when you click on Edit button. But in the attached screenshot, we did not find any hierarchical grid. In your attached screenshot we suspect that you have render the grid with car details inside the dialog when you click on the car icon of an grid behind the dialog.
To provide an solution, please share the details
1. Complete Grid code example.
2. Share the video demonstration of an issue.
3. Syncfusion Package version details.
Regards,
Prasanna Kumar N.S.V
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
MA Muhamad Adam Fakhrullah Nik Mohamad
- Jan 9, 2020 08:27 AM UTC
- Jan 10, 2020 10:27 AM UTC