Hello
I want to know if can disable “key enter” action on row adding, because I trigger a postback in an event fired after a cell has exited edit mode.
GridViewData.RowUpdating += new RowUpdatingHandler(GridViewData_RowUpdating);
GridViewData.Behaviors.EditingCore.Behaviors.CellEditing.CellEditingClientEvents.ExitedEditMode = "GridViewData_CellEditing_ExitedEditMode";
And in the page aspx I have the follow:
<script type="text/javascript" id="igClientScript">
function GridViewData_RowAdding_ExitedEditMode(webDataGrid, evntArgs) {
var grid = webDataGrid; grid.get_behaviors().get_editingCore().get_behaviors().get_rowAdding()._commitRow();
}
</script>
This is okay, because I need it.
In this case, when I’ve exited of a cell edit mode (pressing any key or changing focus), I get a postback and a commit row, but also, when I press “enter key”, get two postbacks and two commits row, and it’s wrong.
Does any way to prevent “key enter” action in GridViewData_RowUpdating(…) function?
How can I solve this problem? Please, help me!
Thanks.
Geovanny Domínguez.
Hello,
I tested this under IE 7 to 10, but it was working. I used NetAdvantage v12.2.20122.1007. What is the version you are using?
Hello Nikolay,
It was very well until I found an error, in Internet Explorer browser doesn't work. I need that it wors in IE.
May you help me, please?
Thank you for your replay, Yeah, it works, you've helped me a lot of.
Hello Geovanny,
I would suggest you to cancel RowAdding ExitingEditMode client-side event if the key pressed is 'enter'. You can use code, similar to the following:
function WebDataGrid1_RowAdding_ExitingEditMode(sender, eventArgs){ if (eventArgs.get_browserEvent().keyCode == 13) { eventArgs.set_cancel(true); }}
Let me know if this helps.