Refresh XtraGrid datasource when trying to edit

I have an XtraGrid with datasource set to BindingList. Some of the fields in the grid are editable. The problem is that the list gets a lot of updates for some other fields (not the ones I can edit), which makes the binding update. If I were in a cell via editing a field, this is discarded and the editor is closed.

Is there a way to keep the kernel with an open editor from updating? Or even make sure that this whole line doesn't get updated if I need to?

+2


source to share


1 answer


In grid mode, you can call BeginDataUpdate () to "prevent visual and internal data updates" until EndDataUpdate () is called.

So you can do something like this (the events you are attaching may not be the best, but you get the idea):



private void gridView1_CellValueChanging(object sender, CellValueChangedEventArgs e)
        {
             gridView1.BeginDataUpdate();
        }

private void gridView1_CellValueChanged(object sender, CellValueChangedEventArgs e)
        {
             gridView1.EndDataUpdate();
        }

      

+5


source







All Articles