Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1470
Overriding ESC key on control
posted
  • Version: 12.2.20122.2075
  • ASP.Net Web Forms.

We have the following code in place when a user presses the ESC key we execute a post back to clear our screen:

// capture ENTER and execute Search, ESC and execute Clear.
		$(document).keypress(function (e) {
			if (e.which == "13") { //enter <-- Works
				document.getElementById('MainContent_btnSearch').click();
				return false;
			}
 
			if (e.which == "27") { // escape <-- fails when focus is in an Infragistics control.
				document.getElementById('MainContent_btnClear').click();
				return false;
			}
 
		});

It appears that the Infragistics control also uses the ESC to clear the value from the control.  Is there a way to prevent/override the Infragistics control from eating the ESC key?

The code handling the Enter key works fine in the same scenario.

Parents
No Data
Reply
  • 1470
    Verified Answer
    Offline posted

    This needs to be moved to Commands and Editors

    <label for="MainContent_WebTabMaster_WebTabCommon_BscControl_9_17_51" id="MainContent_WebTabMaster_WebTabCommon_lblBscControl_9_17_51" class="dynamicFieldsCaptionLabel">Business Unit</label><br />
    <input type="hidden" id="MainContent_WebTabMaster_WebTabCommon_BscControl_9_17_51_clientState" name="MainContent_WebTabMaster_WebTabCommon_BscControl_9_17_51_clientState" />
    <input title="{0}" id="MainContent_WebTabMaster_WebTabCommon_BscControl_9_17_51" readonly="readonly" name="MainContent_WebTabMaster_WebTabCommon_BscControl_9_17_51" class="igte_RedPlanetEdit" type="text" style="color:windowtext;background-color:window;width:66%;text-align:notset;" />
Children
No Data