Click here to Skip to main content
15,889,622 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I recently have learnt about the ModalPopupExtender control and have found it very useful. So, i decided to use them into my website.

So my login.aspx page I has following code/structure:

XML
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:Panel ID="pnl_login" runat="server">
            <%-- textbox & password fields --%>

            <asp:HyperLink ID="hl_getpass" runat="server">Forgot your Password?</asp:HyperLink>
            <asp:ModalPopupExtender ID="hl_getpass_ModalPopupExtender" runat="server"
                DynamicServicePath="" Enabled="True" PopupControlID="pnl_getpassword"
                TargetControlID="hl_getpass">
            </asp:ModalPopupExtender>

            <asp:HyperLink ID="hl_register" runat="server">Register</asp:HyperLink>

            <asp:ModalPopupExtender ID="hl_register_ModalPopupExtender" runat="server"
            DynamicServicePath="" Enabled="True" PopupControlID="pnl_register"
            TargetControlID="hl_register">
            </asp:ModalPopupExtender>

            <asp:Button ID="btn_login" runat="server" OnClick="btn_login_Click"/>
        </asp:Panel>

        <asp:Panel ID="pnl_register" runat="server">
            <%-- signup form --%>
            <asp:Button ID="btn_register" runat="server" OnClick="btn_register_Click"/>
            </asp:Panel>

        <asp:Panel ID="pnl_getpassword" runat="server">
            <%-- email textbox --%>
            <asp:Button ID="btn_sendPassword" runat="server" OnClick="btn_sendPassword_Click"/>
        </asp:Panel>

    </ContentTemplate>
    <Triggers>
        <asp:PostBackTrigger ControlID="btn_login" />
        <asp:PostBackTrigger ControlID="btn_register" />
        <asp:PostBackTrigger ControlID="btn_sendPassword" />
    </Triggers>
</asp:UpdatePanel>



The codes for btn_login, btn_register and btn_sendPassword works just fine but for some reason when they are put into above structure they don't. The button becomes useless, the OnClick events don't seem to get registered.

Surprisingly, when I remove either of the asp:Panel (pnl_register or pnl_getpassword) as well as their respective asp:PostBackTrigger, it works.

I am not sure what is going wrong. Any ideas?
Posted
Comments
jkirkerx 20-Mar-13 16:47pm    
Are you sure there not firing, only you cant't tell?

I remember setting the update panel to children as triggers, and update as conditional

I stopped using the ModalPopupExtender years ago, because I had too much trouble with the ajax control toolkit, and switched to Jquery and simple modal.
Sumit Bharadia 20-Mar-13 16:51pm    
No they are not firing, and it is a mess...:(
jkirkerx 20-Mar-13 17:01pm    
Well, I'm not willing to offer a solution because I haven't used the web markup in years.

I know on the button event click, you have to test if the page is postback, or else it will fire twice, once on page load, and once on postback, clearing any previous results.

Did you click on the button with your mouse in design view to generate the code behind for the button event, so that the handler gets registered?

1 solution

That's a tough one without seeing all the code

I think your just missing the event handler on the button click functions in code behind.
Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
  If page.IsPostback then
   httpcontext.current.response.write("I'm alive")
  End if
End Sub
 
Share this answer
 

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