I have a complex object model so I need to throw up a separate form to add a new one instead of letting the user edit the rows in-place. But I still like the idea of offering the "click here to add row" feature. It's just that when I intercept the OnAddingNewDataItem event I'd like to do this:
But what happens is even when I Cancel out of the dialog box and call CancelEdit, the grid still shows a newly inserted row (with empty values). How can I cancel the add that's in progress programmatically?
Update: similar thing happens when I intercept OnDeletingRow so I can throw up a confirmation dialog box - if the user hits Cancel I'd like to cancel the delete, otherwise commit it, but CancelEdit and CommitEdit don't do the trick
private void OnAddingRow(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
{
var editDialog = new MyFormView(null);
var rowAdded = (bool)editDialog.ShowDialog();
if (rowAdded)
GridView.CommitEdit();
else
GridView.CancelEdit();
}
But what happens is even when I Cancel out of the dialog box and call CancelEdit, the grid still shows a newly inserted row (with empty values). How can I cancel the add that's in progress programmatically?
Update: similar thing happens when I intercept OnDeletingRow so I can throw up a confirmation dialog box - if the user hits Cancel I'd like to cancel the delete, otherwise commit it, but CancelEdit and CommitEdit don't do the trick