Click here to Skip to main content
15,895,740 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,


This is my code for modalpopup control.but it will not work.page loading itself it will give the popup window and the button event not generate a modal popup.

is there any mistake in my code?

can any one help me?


XML
<asp:ScriptManager ID="ScriptManager1" runat="server" />

       <asp:Button ID="Button1" runat="server" Text="Show Modal" OnClick="Button1_Click" />

         <asp:Panel ID="pnlModal" runat="server" CssClass="modal">

              <div class="rel">

                   <div class="modal-inner-wrapper rounded-corners">

                        <div class="content rounded-corners">

                             <div class="close">

                                   <asp:LinkButton ID="btnClose" runat="server">close

                              </div>

                             <div class="body">

                                  <p>Ajax sample!</p>

                                </div>

                       </div>

                   </div>

              </div>

            

      <cc1:ModalPopupExtender ID="ModalPopupExtender1"  runat="server" BackgroundCssClass="modal-bg" TargetControlID="Button1" PopupControlID="pnlModal" CancelControlID="btnClose" >
Posted
Updated 7-Dec-11 22:10pm
v2
Comments
[no name] 8-Dec-11 4:10am    
EDIT: added "pre" tag

remove onclick attribute from button

ASP.NET
<asp:button id="Button1" runat="server" text="Show Modal"  />


hope it will work..
 
Share this answer
 
v2
Comments
Thendral.N 8-Dec-11 4:15am    
i remove that..but it will not show any action..same problem will occur.after clicking the show modal button the modalpopup will genearte but the window is coming page loading itself.
Karthik Harve 8-Dec-11 4:36am    
try by placing your panel and controls inside Update Panel.!!!
where is your
C#
</asp:Panel>


Close your panel tag and then try.
try

C#
<asp:Button runat="server" ID="Button3" Style="display: none" />
<cc1:ModalPopupExtender ID="ModalPopupExtender1"   runat="server" BackgroundCssClass="modal-bg" TargetControlID="Button3" PopupControlID="pnlModal" CancelControlID="btnClose" >


and on Button1 click event use
C#
this.ModalPopupExtender1.Show();
 
Share this answer
 
v4
Comments
Thendral.N 8-Dec-11 4:28am    
already it was closed.
uspatel 8-Dec-11 4:44am    
check my updated answer.
hope it will solve your problem.
Thendral.N 8-Dec-11 5:34am    
all this i tried..but i dont know what's the problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900