This is a migrated thread and some comments may be shown as answers.

CellEditEnded event - Dispatcher exception

1 Answer 59 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Vinetha
Top achievements
Rank 1
Vinetha asked on 28 Aug 2013, 06:07 AM

Hi,

We are using MVVM model. There are two grids parent and Child. Child Grid will be loaded on selecting any Parent row. Child grid will have all cells in Edit mode on Cell Focus and any change done to the cells will be auto saved. The task is to reload the Parent and Child grid when any concurrency exception occurs while auto saving Cells in Child grid. Below code is used to raise an Concurrency exception in viewmodel which is handled to display message box. Once the message is shown dispatcher exception is occuring.

Can you suggest any solution to avoid the Dispatcher  exception?


 

Xaml.cs
---------
private void childgrd_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)

{

viewmodel.HandleCellEditEnded(e.Cell.Column.DisplayIndex);

viewmodel.HeaderSelected = e.Cell.Column.Header.ToString();

}

viewmodel
-------------
public void HandleCellEditEnded(int Column)
{
Update();
}

public void Update()
{
try
{
  //Save child grid changes
}
catch (DbUpdateConcurrencyException)
{
  MessageBox.Show("Concurrency exception occured");
  SelectedParent = null;
  ParentGridCollection = null;               
  SelectedChild = null;
  childGridCollection = null;
  LoadParent();
}
}

Regards,
Vinetha.P

1 Answer, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 02 Sep 2013, 06:42 AM
Hello,

Could you please send me a sample project which demonstrates this issue, since I cannot figure out what is going on based on the provided information?
Thank you in advance.

Regards,
Nedyalko Nikolov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Vinetha
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Share this question
or