ModalPopupExtender和z-index

时间:2009-09-28 16:23:02

标签: asp.net asp.net-ajax

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

3 个答案:

答案 0 :(得分:5)

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

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

答案 1 :(得分:3)

我使用这个功能:

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

答案 2 :(得分:0)

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

function pageLoad()
{
    var popup = $find('ModalPopupClientID');
    popup.add_shown(SetzIndex);
}

function SetzIndex(sender,args)
{
    sender._container.style.zIndex=9990001;
}