RadWindow Preventing First PostBack

2 posts, 0 answers
  1. Josh
    Josh avatar
    7 posts
    Member since:
    Nov 2012

    Posted 03 Jan 2013 Link to this post

    I have some ASP buttons inside a RadWindow Content Template that are behaving strangely. The first time a button is clicked, no postback occurs, but any javascript that I have set to run on the client click event does run. However, a postback does occur after every subsequent click. Currently, VisibleOnPageLoad is false, but if I set VisibleOnPageLoad to true, the buttons post back every time. I cannot see any javascript errors in the error console of any browser when I click the button for the first time. What is happening?

    The buttons in question are btnPrintPrivacyPolicy and btnContinue. The button btnCancel is a javascript-only button, so it isn't expected to postback.

    <telerik:RadCodeBlock ID="rsbCodeBlock" runat="server">
        <script type="text/javascript">
            function validate() {
                var validationResult = Page_ClientValidate("ConsumerCreditApplication");
                if (validationResult && $get("tblCoapplicant").style.display != "none") {
                    validationResult = (validationResult && Page_ClientValidate("ConsumerCreditCoapplication"));
                } // end if
     
                if (validationResult) {
                    this.disabled = "disabled";
                } // end if
     
                return validationResult;
            } // end validate()
     
            function showPrivacyPolicy(show) {
                var wndPrivacyPolicy = $find('<%=wndPrivacyPolicy.ClientID %>');
                if (show) {
                    wndPrivacyPolicy.show();
                } else {
                    wndPrivacyPolicy.close();
                } // end else
            } // end showPrivacyPolicy()
        </script>
    </telerik:RadCodeBlock>
     
    <asp:Button ID="btnSubmit" runat="server" Text="Submit"
                OnClientClick="if (validate()) { showPrivacyPolicy(true); } return false;" />
     
    <telerik:RadWindow ID="wndPrivacyPolicy" runat="server" AutoSize="true" VisibleOnPageLoad="false" Behaviors="Close" VisibleStatusbar="false" Title="Privacy Policy" Modal="true" MinWidth="800" MinHeight="600">
        <ContentTemplate>
            <div id="divPrivacyPolicy" runat="server"><span>test</span></div>
            <div style="text-align: right; padding: 3px;">
                <asp:Button ID="btnPrintPrivacyPolicy" runat="server" Text="Print" UseSubmitBehavior="false" CausesValidation="false"
                    OnClick="btnPrintPrivacyPolicy_Click" />
                <asp:Button ID="btnContinue" runat="server" Text="Continue"
                    OnClientClick="if (!validate()) { return false; }"
                    OnClick="btnContinue_Click" />
                <asp:Button ID="btnCancel" runat="server" Text="Cancel"
                    OnClientClick="showPrivacyPolicy(false); return false;" />
            </div>
        </ContentTemplate>
    </telerik:RadWindow>
  2. Josh
    Josh avatar
    7 posts
    Member since:
    Nov 2012

    Posted 04 Jan 2013 Link to this post

    I have found the solution. When Page_ClientValidate() was called and returning false, it sets Page_BlockSubmit to true, which was preventing the postback of the button. I simply filled out the (lengthy) form correctly and tried again and it worked as expected.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top