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; }
}