I have an editable RadGrid within a RadAjaxPanel that utilizes modal popups and form templates for editing.
When users try to insert a row and push enter, a second modal will come up for editing a row: Screenshot
We don't want to support users pressing enter to submit the modal anyway (they should just click the save button), so I'm trying to prevent the postback being caused by the enter key being pressed using javascript:
Unfortunately this seems to have absolutely no effect (other than that alert I put in there to make sure it's running).
Any idea as to why I'm unable to block this keypress event?
When users try to insert a row and push enter, a second modal will come up for editing a row: Screenshot
We don't want to support users pressing enter to submit the modal anyway (they should just click the save button), so I'm trying to prevent the postback being caused by the enter key being pressed using javascript:
<ClientSettings AllowKeyboardNavigation="False"> <ClientEvents OnKeyPress="BlockEnterKey" /> <KeyboardNavigationSettings AllowSubmitOnEnter="false" /></ClientSettings><script type="text/javascript"> function BlockEnterKey(sender, e) { if (e.get_keyCode() == 13) { alert('Blocking Enter KeyPress'); e.set_cancel(true); e.cancelBubble = true; return false; } }</script>Unfortunately this seems to have absolutely no effect (other than that alert I put in there to make sure it's running).
Any idea as to why I'm unable to block this keypress event?