用ESC键AJAX ModalPopupExtender关闭不工作 [英] Close with escape key ajax ModalPopupExtender not working

查看:200
本文介绍了用ESC键AJAX ModalPopupExtender关闭不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的code来关闭modalPopup但由于某种原因不能正常工作。

 <脚本>
     功能页面加载(发件人,参数){
      如果(!args.get_isPartialLoad()){
        //我们的处理程序添加到文档中的
        // keydown事件
         $ addHandler操作(文件的keydown的onkeydown);
       }
  }功能的onkeydown(五){
如果(E&安培;&安培; e.key code == Sys.UI.Key.esc){
    //如果该键pressed是ESC键,关闭对话框
    找到$('ModalPopupExtenderPanelFullViewProductos')隐藏()。
     }
   }
 < / SCRIPT>< AJAX:ModalPopupExtender ID =ModalPopupExtenderPanelFullViewProductos
                         =服务器的TargetControlID =LinkBut​​tonDummy
                         BackgroundCssClass =modalBackground
                         PopupControlID =PanelFullViewProductos
                         X =20y =50阴影效果=真
                         RepositionMode =无>
 < / AJAX:ModalPopupExtender>


解决方案

您必须设置一个BehaviorID为您模式弹出extender..Then可以使用

  $找到('BehaviorID')隐藏();

请标记为答案,如果它满足你..

I'm using the following code to close a modalPopup but for some reason is not working.

<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>

解决方案

You must set a BehaviorID for your modal popup extender..Then you can use

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

Please Mark as answer if it satisfies you..

这篇关于用ESC键AJAX ModalPopupExtender关闭不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆