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.
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
>