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 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.
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?
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
Thank you for replay. I'm using NetAdvantage v11.1.20111.1006, probably this is cause.
Thank you for your reply.
Glad that the issue has been resolved. Please do not hesitate to contact us if you have any further questions regarding this scenario.
Hello Nokolay,
I already understood, I was making this in GridViewData_RowAdding_ExitedEditMode function and not in GridViewData_RowAdding_ExitingEditMode function. You help me a lot. Thank you very much.
Geovanny Domínguez
I'm just checking if you have managed to resolve your issue.
Hi Geovanny,
I created a sample with 11.1.1006, but still it is working under IE. I am attaching the sample for your reference. Let me know if it is working on your side.