2012-10-23 37 views
0

我已經看過這個和其他論壇中的各種類似問題,但還沒有找到答案。模式彈出式擴展需要2次點擊才能觸發

我有幾個modalpopup擴展與相應的面板。我沒有更新面板或頁面上的任何其他Ajax控件。頁面顯示OK(面板在加載時不可見)。

的問題是第一次一個人試圖打開一個彈出。點擊任何目標按鈕,直到第二次點擊都不會出現彈出窗口。在這個初始故障點擊任意一個按鈕之後,會根據需要顯示相應的面板。

是什麼導致了這個問題。

一個砍下我的代碼版本....

<asp:Button ID="but_Pn1Opn" runat="server" Text="Panel One" /> 
<asp:Button ID="but_Pn2Opn" runat="server" Text="Panel Two" /> 

<asp:ModalPopupExtender ID="mpx_Pn1" runat="server" OkControlID="but_Pn1Cls" 
BehaviourID="Pn1" DynamicServicePath="" Enabled="true" PopupControlID="Pn1" 
TargetControlID="but_Pn1Opn" BackgroundCssClass="modalBackground" /> 
<asp:Panel ID="Pn1" runat="server" Width="600px" CssClass="modalPopup" Style="display:none"> 
<div class="box"> 
<table> 
<tr><th>Panel One Title</th></tr> 
<tr><td>Panel One Content</td></tr> 
<tr><td><asp:Button ID="but_Pn1Cls" runat="server" Text="Close" /></td></tr> 
</table> 
</div> 
</asp:Panel> 

<asp:ModalPopupExtender ID="mpx_Pn2" runat="server" OkControlID="but_Pn2Cls" 
BehaviourID="Pn2" DynamicServicePath="" Enabled="true" PopupControlID="Pn2" 
TargetControlID="but_Pn2Opn" BackgroundCssClass="modalBackground" /> 
<asp:Panel ID="Pn2" runat="server" Width="600px" CssClass="modalPopup" Style="display:none"> 
<div class="box"> 
<table> 
<tr><th>Panel Two Title</th></tr> 
<tr><td>Panel Two Content</td></tr> 
<tr><td><asp:Button ID="but_Pn2Cls" runat="server" Text="Close" /></td></tr> 
</table> 
</div> 
</asp:Panel> 

我的實際頁面有這些面板7。

任何幫助表示讚賞。

回答

1

我複製了你的代碼並運行它。你有包括scriptmanager的權利?另外,我刪除了BehaviourID屬性,因爲我得到了以下錯誤:

「AjaxControlToolkit.ModalPopupExtender」沒有名爲公共財產「BehaviourID」

我認爲這是由於不同版本的工具包。該屬性用於表示與某個事件關聯的Javascript函數。嘗試刪除它,看看會發生什麼。

+0

謝謝...取出BehaviourID做到了....我把它,因爲它是貼在另一篇文章中一些其他的代碼。 – Mych

相關問題