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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to create a function to save data in batch editing in a grid

Thread ID:

Created:

Updated:

Platform:

Replies:

117297 Sep 24,2014 11:01 PM UTC Sep 25,2014 11:08 AM UTC ASP.NET Web Forms 1
loading
Tags: Grid
Roimer Machacón Otero
Asked On September 24, 2014 11:01 PM UTC

Hi, We're using a grid control with batch editing

http://asp.syncfusion.com/demos/web/Grid/BatchEditing.aspx

Now how to create a function for obtain the data of the rows edit in the grid for send by ajax this data

Attachment: batchsave_fc96e1e8.rar

Alan Sangeeth S [Syncfusion]
Replied On September 25, 2014 11:08 AM UTC

Hi Nestor,

 

Thanks for using Syncfusion Products.

 

We are glad to let you know that we have created a sample based on your requirement and the same can be downloaded from below link.

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/Sample-959640018.zip

 

We would like to let you know that in JavaScript Grid we have property “CrudUrl” which is used for Server-Side CRUD operation and we have missed to include this property in ASP.Net Grid. But in our latest version we have included it in ASP.Net Grid and you can download the Essential Studio latest from the below link.

Essential Studio v12.2.0.42: www.syncfusion.com/forums/117190/essential-studio-2014-volume-2-service-pack-2-release-v12-2-0-42-available-for-download

 

For now we have provided you the above sample as workaround in which at Grid “load” event, we are binding data to Grid datsource using custom adaptor and using “batchUrl” property of Grid we have passed the edited records to the server side. Please refer the following code snippets.

<ej:Grid ID="EmployeesGrid" runat="server" AllowPaging="true" Width="1500px" Load="loadHandler">

<EditSettings AllowAdding="True" AllowEditing="True" AllowDeleting="True" EditMode="Batch">EditSettings>

<DataManager URL="Default.aspx/Data" Adaptor="UrlAdaptor"  />

...

ej:Grid>

 

<script>

var adaptor = new ej.UrlAdaptor().extend({

processResponse: function (data, ds, query, xhr, request, changes) {

 

return data.d;

}

});

function loadHandler(args) {

args.model.dataSource.dataSource.batchUrl = "Default.aspx/Update"

args.model.dataSource.adaptor = new adaptor();

}

script>

 

public static object Update(List<Order> changed, List<Order> deleted, List<Order> added)

        {

 

            NORTHWNDEntities1 obj = new NORTHWNDEntities1();

            if(changed != null)

            foreach (var ord in changed)

            {

                obj.Entry(ord).State = EntityState.Modified;

                obj.SaveChanges();

            }

...

            var dataSource = OrderRepository.GetAllRecords();

            return dataSource;

        }

 

Once you have installed latest version please get back to us and we will provide you the above sample modified in accordance with latest version.

 

Please let us know if you have any queries,
Regards,
Alan Sangeeth S


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.

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

;