CellEditEnded event - Dispatcher exception

2 posts, 0 answers
  1. Vinetha
    Vinetha avatar
    5 posts
    Member since:
    Jan 2013

    Posted 28 Aug 2013 Link to this post

    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

  2. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 02 Sep 2013 Link to this post

    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 >>
Back to Top