Silverlight DataGrid and EditLevel

Silverlight DataGrid and EditLevel

Old forum URL: forums.lhotka.net/forums/t/6932.aspx


cds posted on Tuesday, May 12, 2009

Hi

I'm using the Silverlight DataGrid with CSLA Light 3.6.2.

I've got an EditableRootList bound to the grid and it's all working fine, but when I go to save, if one of my cells is still in edit mode, I get the dreaded exception: UndoException - Edit level mismatch in AcceptChanges.

Has anybody got this figured out - I'm beating my head against a brick wall. I've tried calling CancelEdit on the DataGrid but to no avail.

Thanks,

Craig

sergeyb replied on Tuesday, May 12, 2009

Make sure you are running the latest release of the data grid:

 

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=084a1bb2-0078-4009-94ee-e659c6409db0

 

 

Sergey Barskiy

Principal Consultant

office: 678.405.0687 | mobile: 404.388.1899

Magenic ®

Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: cds [mailto:cslanet@lhotka.net]
Sent: Tuesday, May 12, 2009 1:22 AM
To: Sergey Barskiy
Subject: [CSLA .NET] Silverlight DataGrid and EditLevel

 

Hi

I'm using the Silverlight DataGrid with CSLA Light 3.6.2.

I've got an EditableRootList bound to the grid and it's all working fine, but when I go to save, if one of my cells is still in edit mode, I get the dreaded exception: UndoException - Edit level mismatch in AcceptChanges.

Has anybody got this figured out - I'm beating my head against a brick wall. I've tried calling CancelEdit on the DataGrid but to no avail.

Thanks,

Craig



cds replied on Wednesday, May 13, 2009

Hi Sergey

Thanks for the reply - yes I was using the latest verison of the DataGrid.

But in the end I figured it out - hopefully this will help somebody else.

dataGrid.CancelEdit(DataGridEditingUnit.Row);

Dispatcher.BeginInvoke(() =>

{

_listDataProvider.SetErrorMessage(null);

_listDataProvider.Save();

});

It seems that I have to use the Dispatcher to perform the save - I don't fully understand why this is the case except that it seems to give the CancelEdit tme to actually propogate the changes to the BO.

Anyway, all working reliably now :-)

Craig

 

Copyright (c) Marimer LLC