简体   繁体   中英

image button event not fired in c#

Am using the below code to validate and process some other action. In the script, i check the balance amount and pay amount.Pay amount not exceed the balance amount means it return the error message. Then the else part doesn't redirect to my code behind button click event. i can't find it. Please help me to solve this.

 if (ddl_selected == "ebal") {
    var cust_balance = document.getElementById('<%= lbl_balance.ClientID %>');
    var cust_ramount = document.getElementById('<%= lbl_amount.ClientID %>');

            if (cust_balance.innerHTML <= cust_ramount .innerHTML) {
                alert('Error Alert : You don\'t have enough balance.!.');
                return false;
            }
            else {
                return true;
            }

        }

   <asp:ImageButton ID="btn_activate" runat="server" OnClick="btn_pay_Click"
     OnClientClick="return valid_details();"
     ImageUrl="~/Images/pay.png" />

protected void btn_pay_Click(object sender, ImageClickEventArgs e)
{
  //Event not fire 
}

Change

OnClientClick="javascript:valid_details();return true;" instead of

OnClientClick="return valid_details();"

使用OnClientClick =“ javascript:return valid_details();代替OnClientClick =” return valid_details();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM