使用转义键ajax ModalPopupExtender关闭不起作用

问题描述 投票:0回答:2

我正在使用以下代码关闭modalPopup,但由于某些原因无法正常工作。

<script>
     function pageLoad(sender, args){
      if(!args.get_isPartialLoad()){
        //  add our handler to the document's
        //  keydown event
         $addHandler(document, "keydown", onKeyDown);
       }
  }

function onKeyDown(e){
if(e && e.keyCode == Sys.UI.Key.esc){
    // if the key pressed is the escape key, dismiss the dialog
    $find('ModalPopupExtenderPanelFullViewProductos').hide();
     }
   } 
 </script>

<ajax:ModalPopupExtender ID="ModalPopupExtenderPanelFullViewProductos"
                         runat="server" TargetControlID="LinkButtonDummy"  
                         BackgroundCssClass="modalBackground" 
                         PopupControlID="PanelFullViewProductos"
                         X="20" Y="50" DropShadow="true" 
                         RepositionMode="None">
 </ajax:ModalPopupExtender>
asp.net ajax modalpopupextender
2个回答
1
投票

您必须为您的模式弹出窗口扩展程序设置一个BehaviorID。然后您可以使用

$find('BehaviorID').hide();

如果您满意,请标记为答案。


0
投票
$find('BehaviorID').hide();

工作正常!

© www.soinside.com 2019 - 2024. All rights reserved.