Search code examples
c#asp.netupdatepanel

Panel not displayed in UpdatePanel


<form runat="server" id="from1">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <script src='https://www.google.com/recaptcha/api.js'></script>

            <asp:Panel runat="server" ID="pnlSiteQuestions">
                >>>>> CONTROLS removed for brevity <<<<<
                <asp:Button ID="btnContinue" runat="server" Text="Continue" OnClick="btnContinue_Click" ValidationGroup="Questions" />
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>

    <asp:Panel ID="pnlNotRequired" runat="server" Visible="false">
        Sorry you do not qualify.
    </asp:Panel>

    <asp:Panel runat="server" ID="pnlAdditionalDetails" Visible="false">
                    <asp:ValidationSummary runat="server" ID="ValidationSummary1" />
                        Name
                        <asp:RequiredFieldValidator runat="server" ID="ValidatorName" ControlToValidate="ContactFormNameTextBox" ErrorMessage="Name is required" CssClass="ErrorClass">Required</asp:RequiredFieldValidator>

                        <asp:TextBox runat="server" ID="txtName" />

                            <div class="g-recaptcha" data-sitekey="ABC123"></div>
                        <asp:Button runat="server" ID="button1" Text="Confirm" OnClick="button1_Click" />
            </asp:Panel>

</form>

I have the above form and decided to add an update panel. When a user clicks Continue, it goes to a database and determines if the user qualifies. If not pnlNotRequired message is displayed otherwise pnlAdditionalDetails is displayed.

Everything is/was working until i added the update panel. So removing the UP has everything working.

I tried adding a trigger but i didnt fully understand how it should be configured as i dont completely understand why this is occurring?

No Javascript errors listed either. Anyway to overcome this issue?


Solution

  • Update panel should cover all panels. Add property to update panel "UpdateMode='Conditional'" than add trigger block