9
Answers

On Client Click is not working

Abhineet Srivastava

Abhineet Srivastava

10y
5.5k
1
I have asp.net button--

<asp:Button ID="btnCommit" runat="server" Text='<%$ Resources:ZippSlipsResource, ViewForm_Commit %>'
                    CssClass="button green savensendbtn" OnClick="btnCommit_Click" OnClientClick="return ValidSave();"  />


My Java Script is-
-----------

  <script type="text/javascript">
        function ValidSave() {
            if (typeof (Page_ClientValidate) === "function")
                if (!Page_ClientValidate())
                    return false;

            if ($("span[id$='lblPayPalUserMissing']").attr("IsMissing") == "true" && $("input[id*='rblPaymentMode']:checked").val() == '<%= ZippSlips.Core.Model.Enums.PaymentMode.CreditCard %>') {
                $.blockUI({ message: $("div#MissingPaypalAccountError") });
                return false;
            }
            else if ($("#liMandatoryItemError").length > 0 && $(".paymentgrid").find("input[type='radio'],input[type='checkbox']").length > 0 &&
                        $(".paymentgrid").find("input[type='radio']:checked,input[type='checkbox']:checked").length == 0) {
                $("#liMandatoryItemError").removeClass("hide");
                return false;
            }
            else {
                return true;
            }
        }
    </script>

Problem is my Java Script code is not firing on Button click.
is any one have adea about this?



Answers (9)