Reputation: 2553
I have looked at various similar questions in this and other forums but have not found the answer.
I have several modalpopup extenders with corresponding panels. I have no update panels or any other ajax controls on the page. The page displays OK (panels are invisible on load).
The problem is the first time one tries to open a popup. Clicking on any of the Target buttons result in no popup appearing until the second click. After this initial glitch clicking any of the buttons once will make the corresponding panel appear as required.
What is causing this issue.
A cut down version of my code....
<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>
My actual page has 7 of these panels.
Any help appreciated.
Upvotes: 0
Views: 1300
Reputation: 3615
I copied your code and ran it. You do have a scriptmanager included right? Also, I removed the BehaviourID attribute as I got the following error:
'AjaxControlToolkit.ModalPopupExtender' does not have a public property named 'BehaviourID'
I assume this is due to different versions of the toolkit. This attribute is used to denote what Javascript function to associate with an event. Try removing it and see what happens.
Upvotes: 1