![](/img/trans.png)
[英]Is there a way to create a Yes/No popup in ASP.Net VB by calling a function from the code behind?
[英]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.