【问题标题】:ModalPopupExtender and z-indexModalPopupExtender 和 z-index
【发布时间】:2009-09-28 16:23:02
【问题描述】:

如何更改 ASP.NETAJAX ModalPopupExtender z-index。默认为 100001。 谢谢。

【问题讨论】:

    标签: asp.net asp.net-ajax


    【解决方案1】:

    我将一个 CSS 类分配给我的 modalpopupextender 分配给的面板 (PopupControlID),并输入如下内容:

    .ModalSelect 
    {
       z-index:70000 !important;
       /*other css*/ 
    }
    

    【讨论】:

      【解决方案2】:

      我使用这个功能:

        function ShowModalPopup(modalPopupId, zIndex) {
      
          try {
            if (modalPopupId == null) throw new Error(0, 'Incorrect value of param modalPopupId!');
      
            var modalPopupBehavior = $find(modalPopupId);
            if (modalPopupBehavior == null) throw new Error(0, 'Not found modal popup ' + modalPopupId + '!');
      
            zIndex = typeof (zIndex) != 'undefined' ? zIndex : null;
      
            if (zIndex != null) {
              modalPopupBehavior._backgroundElement.style.zIndex = zIndex;
              modalPopupBehavior._foregroundElement.style.zIndex = zIndex + 1;
            }
      
            modalPopupBehavior.show();
          }
          catch (ex) {
            alert('Exception in ShowModalPopup: ' + ex.message);
          }
        }
      

      及其调用:

        ShowModalPopup('<%= modalpopup.ClientID %>', 20001);
      

      【讨论】:

        【解决方案3】:

        您可以将处理程序连接到modalpopup上显示的事件,允许您设置zIndex:

        function pageLoad()
        {
            var popup = $find('ModalPopupClientID');
            popup.add_shown(SetzIndex);
        }
        
        function SetzIndex(sender,args)
        {
            sender._container.style.zIndex=9990001;
        }
        

        【讨论】:

          猜你喜欢
          • 2010-11-04
          • 1970-01-01
          • 2011-07-13
          • 2011-12-06
          • 2013-04-03
          • 2012-03-07
          • 1970-01-01
          • 1970-01-01
          • 2010-12-28
          相关资源
          最近更新 更多