This is a migrated thread and some comments may be shown as answers.

RadWindow Preventing First PostBack

1 Answer 59 Views
Window
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 04 Jan 2013, 01:29 AM
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>

1 Answer, 1 is accepted

Sort by
0
Josh
Top achievements
Rank 1
answered on 04 Jan 2013, 04:37 PM
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.
Tags
Window
Asked by
Josh
Top achievements
Rank 1
Answers by
Josh
Top achievements
Rank 1
Share this question
or