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

How to Edit Cell in GridDataControl

Hi,

I just started using Syncfusion V8.2.0.18.

My usuage is to Use GridDataControl to bind to the Sql Datasource, Edit the Cell and Save it to the Database, Insert a new record and Save it to the Database.

I couldnt find any rowedit events.

How should I use the GridDataControl?

I appreciate your time and quick response.

Thanks.



1 Reply

JJ Jeraldes J Syncfusion Team October 12, 2010 11:32 AM UTC

Hi Hema,

Thank you for your interest in Syncfusion products.

We would be glad to assist you on this query.

1.Edit Operation

The GridDataControl is bound to an Entity model the changes made in the Grid has to be updated to the Entity model by listening to the EndEdit event of the currency manager. The save will be handled automatically when the cell is out of edit mode.

[Code Snippet]

this.dataGrid.Model.CurrencyManager.OnEndEdit += ((s, e) =>
{
//Save handled
entity.SaveChanges();
});


2.Delete operation

The Delete operation can be triggered from the collection changed event as follows.

[Code Snippet]

this.dataGrid.Model.View.CollectionChanged += ((s, e) =>
{
//Delete handled
if (e.Action == NotifyCollectionChangedAction.Remove)
{
foreach (var item in e.OldItems)
{
entity.DeleteObject(item);
entity.SaveChanges();
}
}
});


Please refer the sample in the following location.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=Databind_Entity-1826668124.zip


Sample Usage:
Change the field values or delete a record in the GridDataControl and click the "Load Data in SDK Grid" button to load the updated data to the SDK grid.

Let us know if this helps.

Regards,
Jeraldes J



Loader.
Live Chat Icon For mobile
Up arrow icon