This is a migrated thread and some comments may be shown as answers.

Cancel Row Insert

1 Answer 59 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 29 Mar 2012, 06:01 PM
I have a grid on a screen that ShowInsertRow is set to true.  When the user can add data and when they leave that row I have a RowEditEnded method that inserts the data into the database.  If the insert fails or they do not add any new data  nothing new is inserted into the database, but the row on the screen is still there.  Is there a way to remove that new row if no data was entered.

1 Answer, 1 is accepted

Sort by
0
Frank
Top achievements
Rank 1
answered on 29 Mar 2012, 06:09 PM
Ok nevermind I found a way.  Not sure if it is the best way but for anyone else looking for this in the RowEditEnded event do the following:

GridView.Items.Remove(e.NewData);

this removes the new line from the table.
Tags
GridView
Asked by
Frank
Top achievements
Rank 1
Answers by
Frank
Top achievements
Rank 1
Share this question
or