2010-09-15 56 views
0

我無法使用ModalPopupExtender獲取我的面板彈出窗口。 下面的代碼ASP.NET Ajax和ModalPopupExtender不顯示

.modalBackground 
{ 
    background-color:#CCCCFF; 
    filter:alpha(opacity=40); 
    display:none; 
    opacity:0.5; 
} 
.ModalWindow 
{ 
    border: solid1px#c0c0c0; 
    background:#f0f0f0; 
    padding: 0px 10px 10px 10px; 
    position:absolute; 
    top:-1000px; 
    left:-1000; 
} 

,代碼:

<asp:ScriptManager runat="server"> 
</asp:ScriptManager> 
<asp:UpdatePanel runat="server"> 
    <ContentTemplate> 
     <asp:Panel ID="panEdit" runat="server" Height="180px" Width="400px" CssClass="modalBackground"> 
      Content goes here 
      <asp:Button ID="btnCancel" runat="server" Text="Cancel" /> 
     </asp:Panel> 
     <asp:LinkButton runat="server" ID="btnPopup" Text="pop" /> 
     <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" RepositionMode="RepositionOnWindowResize" 
      TargetControlID="btnPopup" PopupControlID="panEdit" BackgroundCssClass="modalBackground" 
      CancelControlID="btnCancel"> 
     </asp:ModalPopupExtender> 
    </ContentTemplate> 
</asp:UpdatePanel> 

當我點擊btnPopup,沒有任何反應。 有什麼想法?

回答

1

你從哪裏得到這段代碼? 有了這個參數在CSS上,我不認爲你曾經看到過一種模式。

top:-1000px; 
left:-1000; 

無論如何,我認爲你必須遵循由MS給出的例子,只需複製/粘貼和處理該例子。這個例子與你完全不同。

http://www.asp.net/ajaxlibrary/download.ashx獲取SDK,然後在實例搜索ModalPopUp

5

可能爲時已晚,以幫助,但如果在這個任何人都跌倒,我敢肯定的答案就是更換: <asp:ScriptManager runat="server"></asp:ScriptManager><asp:ToolkitScriptManager ID="whatever" runat="server">

您的彈出窗口沒有得到正確的js設置的行爲。一旦你安裝了AjaxControlToolkit,ToolkitScriptManager就可以使用了。不幸的是,這個小小的附註並未包含在分步安裝說明中。

還有一件事。用-1000px;替換-1000;

相關問題