I need to call 2 functions in the onclick using the LinkButton control, it cannot execute the javascript Function :
<asp:LinkButton ID="btnVirement" value="virement" runat="server" style="color: #f15d22;" onclick="CatchLinkVirement();btnVirement_Click" ><u><b>Comment effectuer un virement ?</b></u></asp:LinkButton>
and this is the CatchLinkVirement() javaScript function :
function CatchLinkVirement() {
var pLinkVirement = document.getElementById("btnVirement").value;
sessionStorage.setItem("pClickVirement", pLinkVirement);
alert(pLinkVirement);
}
and this is my codebehind :
public void btnVirement_Click(object sender, EventArgs e)
{
HttpContext.Current.Session["BonSavoirPopup"] = "BonAsavoirVirement";
Response.Redirect("Mytransfers.aspx");
}
You can try like this:
OnClick="btnVirement_Click" OnClientClick="return CatchLinkVirement();"
Write below line inside your button click handler(Server Side)
ScriptManager.RegisterStartupScript(this, this.GetType(), "SimpleScript", "CatchLinkVirement();", true)
This way you can call javascript function from code behind.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With