I currently have a WPF application with a RadGridView control from Telerik. I have some columns with data from a database, while I have three more custom made columns which are for entering in data. My problem right now is that once I enter data into a cell within one of the columns, as I click out of that cell the data disappears. I need to get my application to commit those changes so that doesn't happen. I thought I had it coded correctly using gridView.CommitEdit();
within the CellEditEnded event, however a stackoverflow exception is thrown when I enter the data and click out of the cell. Is anyone able to explain to me why that is and a possible solution to this issue? I'm having a hard time finding good resources online explaining how to do this. Below is my code for the CellEditEnded event:
private void gridView_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)
{
if(e.EditAction == GridViewEditAction.Commit)
{
gridView.CommitEdit();
}
}
If anyone is able to help me understand what I am doing wrong, it would be greatly appreciated :)
You could try to use a boolean flag to prevent the event handler from calling the CommitEdit()
method over and over again:
bool handle = true;
private void gridView_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)
{
if (e.EditAction == GridViewEditAction.Commit && handle)
{
handle = false;
gridView.CommitEdit();
handle = true;
}
}