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. Image for the cookie policy date

Update column value based on other column values in ASP.NET MVC Grid

How to set one cell value based on the other cell value in grid JS2 MVC or JS2?

1 Reply

PS Pavithra Subramaniyam Syncfusion Team May 8, 2019 05:52 AM

 
Thanks for contacting Syncfusion support. 
 
We have analyzed your requirement. We suspect that you would like to update a column value(for example “Total” column) based on other column values while performing editing in Grid. We have achieved this requirement by using the “ActionBegin” event of Grid. In the “ActionBegin” handler, based on the “requestType” as “save”, we have updated the “args.data.Total” value. Please refer the cod example below, 
 
 
<div> 
    @Html.EJS().Grid("Grid")...ActionBegin("ActionBegin")...Render() 
</div> 
 
<script type="text/javascript"> 
    function ActionBegin(args) { 
        if (args.requestType == "save") { 
            args.data.Total = document.getElementsByName("OrderID")[0].value * document.getElementsByName("EmployeeID")[0].value;  //Update "Total" column based on OrderID and EmployeeID values 
        } 
    } 
</script> 
 
 
We are also attaching the sample for your convenience, please download the sample from the link below, 
 
Please get back to us if you need further assistance. 
 
Regards, 
Pavithra S. 


Loader.
Live Chat Icon For mobile
Up arrow icon