Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

Change CurrentRow on/after cancelling UserAddingRow

$
0
0

Hi,

I have a problem with unselecting the new Row in my grid.

To explain the problem, i have a grid, where the user can add data to by using the new Row.

When clicking the new Row, it gets populated with some default data and can be edited.

I wanted to make sure the edited data gets saved when the user leaves the new Row,

so i used the UserAddingRow event to open a MessageBox to ask the user if he wants to save.

If yes, all right.

If no, I use e.Cancel to reject the data.

=> At this point I would like the new Row to change back to the initial "Click here to add new row" state,

but it stays selected or defined as CurrentRow. The data is gone, but an empty row stays as long as I don't switch to

another row manually, even when the data bound to the grid changes.

I can't find a way to unselect the row or set CurrentRow = null, as it seems not to be possible out of the event.

Also there seems to be no other event to hook up to after UserAddingRow when cancelled.

 

Maybe there is an easy way of unselecting, or maybe I'm using the wrong event for that purpose.

I would be glad for some help. :)

  

01.privatevoidRadGridViewClockTimeUserAddingRow(objectsender, GridViewRowCancelEventArgs e)
02.        {
03.            var result = RadMessageBox.Show(
04.                this,
05.                Resources.DoYouWantToSaveNew,
06.                Resources.Save,
07.                MessageBoxButtons.OKCancel);
08. 
09.            if(result == DialogResult.OK) return;
10. 
11.            e.Cancel = true;
12.            // CurrentRow = null ??
13.        }


Viewing all articles
Browse latest Browse all 84751

Trending Articles