ASP.NET: ModalPopupExtender prevents button click event from firing

Posted by C. Griffin on Stack Overflow See other posts from Stack Overflow or by C. Griffin
Published on 2010-05-20T20:28:49Z Indexed on 2010/05/20 20:30 UTC
Read the original article Hit count: 280

Filed under:
|
|
|

Here is what I'm trying to do: Click a button on my page, which in turn makes (2) things happen:

  1. Display a ModalPopup to prevent the user from pressing any buttons or changing values
  2. Call my code behind method, hiding the ModalPopup when finished

Here is the ASP markup:

<asp:UpdatePanel ID="UpdatePanel2" runat="server" ChildrenAsTriggers="true"
    UpdateMode="Always">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnSaveData" EventName="Click" />
    </Triggers>
    <ContentTemplate>
        <asp:Panel ID="pnlHidden" runat="server" style="display: none;">
            <div>
            <h1>Saving...</h1>
            </div>
        </asp:Panel>
        <cc1:ModalPopupExtender ID="modalPopup"
            BackgroundCssClass="modalBackground" runat="server"
            TargetControlID="btnSaveData" PopupControlID="pnlHidden">
        </cc1:ModalPopupExtender>
        <asp:Button ID="btnSaveData" runat="server" Text="Save Data"
            OnClick="btnSaveData_Click" />
    </ContentTemplate>
</asp:UpdatePanel>

Now, here is my code behind C# code:

protected void btnSaveData_Click(object sender, EventArgs e)
{
   UpdateUserData(GetLoggedInUser());
   modalPopup.Enabled = false;
}

Why doesn't this work? The ModalPopup displays perfectly, but the btnSaveData_Click event NEVER fires.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about AJAX