两次的usercontrol中关闭modalpopupexten

两次的usercontrol中关闭modalpopupexten

本文介绍了如何在按下esc键时在一个页面中使用两次的usercontrol中关闭modalpopupextender?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script type="text/javascript">

    function pageLoad(sender, args) {
        if (!args.get_isPartialLoad()) {
            $addHandler(document, "keydown", onKeyDown);
        }
    }

    function Hide(controlID) {
        var mpe = $find(controlID);
        mpe.hide();
        var mpe = $find('ModalPopupExtender1');
        mpe.hide();
    }
    function onKeyDown(e) {
        if (e && e.keyCode == Sys.UI.Key.esc) {
            Hide(document.getElementById("<% =ModalPopupExtender1.ClientID%>"));
        }
    }
</script>Close with escape key ajax ModalPopupExtender not working

in two days of searching I can't still find any answer for this.

Anyway, I have modal pop up extender in usercontrol then I used my user control twice in one page.

My problem is I can't close it with esc key is click with the code above. it always null or cant find something.

Then, I tried using behaviorID but it cannot be done too.

    function pageLoad(sender, args) {
        if (!args.get_isPartialLoad()) {
            $addHandler(document, "keydown", onKeyDown);
        }
    }


    function onKeyDown(e) {
        if (e && e.keyCode == Sys.UI.Key.esc) {
            $find('bhiModalPopupExtender1').hide();
        }
    }


<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="Panel1" TargetControlID="hdnModalPopup" BehaviorID="bhiModalPopupExtender1"

    CancelControlID="hdnModalPopup" BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>Thanks for helping.

推荐答案




这篇关于如何在按下esc键时在一个页面中使用两次的usercontrol中关闭modalpopupextender?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 12:31