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
close icon

Pass the Updated EjGrid Values to the controller using ajax.

Hi, 
       I am using EjGrid with dropdown column which is not editable in normal editing mode.so i m using batch edit mode.after editing all the rows i want to update them in database.so i am passing the grid values to controller.But i didn't get the updated values in controller.Here is my ajax code to pass the grid values to controller



  $('#SaveGrid').click(function () {

            var gridObj = $("#Grid").ejGrid("model");
            alert(gridObj);
            var G1 = JSON.stringify(gridObj);
            alert(G1);
      })

i want to pass the updated grid values to the controller in an external button click. and i didn't use the toolbar for this grid.

1 Reply

PK Prasanna Kumar Viswanathan Syncfusion Team April 14, 2015 02:50 PM UTC

Hi Ganga,

Thanks for using Syncfusion Products.

Your requirement have been achieved by the batchSave public api in ejGrid. In button click event we suggest you to invoke batchSave method. While using batchSave method it will pass the updated grid values to the controller.

Please find the below code snippet :



<script type="text/javascript">

$("#button").ejButton({

click: function (args) {

var grid = $("#FlatGrid").ejGrid("instance");

grid.batchSave();

}

});

</script>

For your convenience we have created a sample and sample can be downloaded from the below link

Sample Link : http://www.syncfusion.com/downloads/support/forum/118821/Sample2116279786.zip

Please let us know if you have any further assistance.

Regards,

Prasanna Kumar N.S.V


Loader.
Live Chat Icon For mobile
Up arrow icon