Hi Everybody, I'm using a ModalPopUp in an Asp.net application and would like to have it closing automaticaly when user clicks "esc".
I've used the following script:
<script language="JavaScript" type="text/javascript">
function pageLoad() {
$addHandler(document, 'keydown', onKeypress);
}
function onKeypress(args) {
if (args.keyCode == Sys.UI.Key.esc) {
var mdl = $find('modalExtender').hide();
}
}
</script>
And the Modal Extender is declared like that:
<cc1:ModalPopupExtender
ID="modalExtender"
runat="server"
TargetControlID="btnPreview"
PopupControlID="PreviewPanel"
BackgroundCssClass="modalBackground"
DropShadow="true"
CancelControlID="btnFechar" />
When I press the "esc" key I'm getting this error: "Microsoft JScript runtime error: 'null' is null or not an object"
Has someone had the same problem? How was it solved? Thank you in advance.
Josimari Martarelli