开发者

Gridview - Edit Mode - When I press return on my keyboard, the edit item index changes to the first row

开发者 https://www.devze.com 2022-12-30 09:11 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消