When I am in e开发者_如何学编程dit mode on any row of my GridView and I press Return while the focus is in one of the row's textboxes, instead of triggering the update button, my GridView1.RowEditing event is fired with a NewEditIndex of 0
This causes the first row to become editable and I lose any values typed into the previous row.
How can I stop this from happening?
Thanks
Take the GridView RowCommand event that fires when you hit the return button, check to see if the event that triggered it was a user keystroke on a grid row in edit mode, and have it call the same method that your Update button command would call, then set EditIndex to
-1, which indicates no row is being edited.
精彩评论