2010-02-28 22 views
4

我正在開發與Visual Studio 2008 SP1和C#的ASP.NET Web窗體應用程序。問題與jQuery用戶界面對話框時模式設置爲TRUE

我有以下ASPX頁面:

<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"> 
    <title></title> 
    <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script> 
    <script src="js/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script> 
    <script type="text/javascript"> 
     $(document).ready(function() { 
      $("#dialog").dialog({ 
       autoOpen: false, 
       modal: true, 
       buttons: { 
        'Ok': function() { 
         __doPostBack('TreeNew', ''); 
         $(this).dialog('close'); 
        }, 
        Cancel: function() { 
         $(this).dialog('close'); 
        } 
       }, 
       close: function() { 
       }, 
       open: function(type, data) { 
        $(this).parent().appendTo("form"); 
       } 
      }); 
     }); 
     function ShowDialog() { 
      $('#dialog').dialog('open'); 
     } 
    </script> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <div> 
     <asp:Button ID="TreeNew" runat="server" Text="Nuevo" 
      OnClientClick="ShowDialog();return false;" onclick="TreeNew_Click"/> 
     <asp:Label ID="Message" runat="server"></asp:Label> 
     <div id="dialog_target"></div> 
     <div id="dialog" title="Select content type"> 
      <p id="validateTips">All form fields are required.</p> 
      <asp:RadioButtonList ID="ContentTypeList" runat="server"> 
       <asp:ListItem Value="1">Text</asp:ListItem> 
       <asp:ListItem Value="2">Image</asp:ListItem> 
       <asp:ListItem Value="3">Audio</asp:ListItem> 
       <asp:ListItem Value="4">Video</asp:ListItem> 
     </asp:RadioButtonList> 
     </div> 
    </div> 
    <asp:ScriptManager ID="ScriptManager1" runat="server"> 
    </asp:ScriptManager> 
    </form> 
</body> 
</html> 

當模式設置爲true的頁面明星成長(我知道,因爲這兩種滾動條也變得越來越小,豎條比單槓更快)。

漂亮的網頁源代碼裏我看到了下面的div是外面形式標籤:

<div class="ui-widget-overlay" style="z-index: 1001; width: 1280px; height: 65089px;" jQuery1267345392312="20"/> 

如果我設置模式爲false,錯誤不會發生。我認爲問題在於,作爲模態工作的div不在表單中。

您認爲如何?

回答

2

設置此樣式,將解決這一問題

<style type="text/css"> 

.ui-widget-overlay 
{ 
    background-color: #000000; 
    left: 0; 
    opacity: 0.5; 
    position: absolute; 
    top: 0; 
} 

.ui-dialog 
{ 
    background-color: #FFFFFF; 
    border: 1px solid #505050; 
    position: absolute; 
    overflow: hidden; 
} 


</style> 
1

我認爲你是對的,覆蓋層是淡出其餘的頁面,但正如你看到的只是進入你正在使用的whateer主題,你可能會破解ui-widget-overlay類而不能增長儘可能多的,必須說它與65089像素高度看起來很奇怪。您可以嘗試將最大高度設置爲100%。

+0

有一個滾動條問題,問題是,我沒有任何主題,重視aspx頁面。 – VansFannel

+0

現在,這是一個jQuery主題,而不是一個aspx主題。無論如何,將這些類添加到您的css(或內聯)並調整它,您應該很好。 – cjensen

0

嘗試在對話框的關閉事件做這個(對話框destroy()s前的疊加):

div.data('dialog').overlay.$el.css({height: 0, width: 0}); 

我認爲這事做了,jQuery UI覆蓋對象重複使用DIV,而不是刪除的事實它。

1

在IE 8 here發現這一點,固定對我來說:

「的位置CSS屬性類的改變的.ui-小窗口從絕對到固定覆蓋修正滾動條問題,對我們來說卻造成了內存流失和掛在IE 6.我發現了一個解決有關此通過執行以下操作在一個CSS文件:

.ui-widget-overlay { position: fixed; } 
.ui-widget-overlay { _position: absolute; } 

第一個條目用於更正IE 8中的滾動條問題,並在工廠中生效。與第二項的「_」在IE 6只拾起,並設置位置回絕對,因爲我們從來沒有在IE 6

相關問題