簡體   English   中英

從Asp.net VB中的代碼后面調用OnClientClick

[英]Calling OnClientClick from Code behind in Asp.net VB

我有這樣的代碼:

<asp:LinkButton runat="server" ID="HL_KonfirmasiPemesanan" class="button-primary button-shadow" causesvalidation="false" validationgroup="ValidasiData"  OnClientClick="return getConfirmation(this);"  ></asp:LinkButton>

然后我要致電OnClientClick="return getConfirmation(this);" 在后面的代碼中,我嘗試了:

HL_KonfirmasiPemesanan.Attributes.Add("OnClientClick", "return getConfirmation(this);")

但這不起作用,我該怎么辦?

你可以這樣做:

dim script as String = "<script>var btn = document.querySelector('.button-primary'); getConfirmation(btn);</script>"
ClientScript.RegisterStartupScript(Me.GetType(), "click_Btn", script)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM