We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Child grid ( primary key from parent grid is null)

Thread ID:

Created:

Updated:

Platform:

Replies:

150502 Jan 9,2020 08:27 AM UTC Jan 10,2020 10:27 AM UTC ASP.NET Core - EJ 2 1
loading
Tags: DataGrid
Muhamad Adam Fakhrullah Nik Mohamad
Asked On January 9, 2020 08:27 AM UTC

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

        }




Prasanna Kumar Viswanathan [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon