OnClientClick事件未触发 [英] OnClientClick event not firing
本文介绍了OnClientClick事件未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个问题,即与imagebutton上的onclienclick事件有关.它执行服务器单击并且页面回发(自动刷新),而我为此事件提供了一个JavaScript,这是行不通的.
如何停止imagebutton的clientclick上的回发?
谢谢
I have a question i.e related to onclienclick event on imagebutton.It executes server click and page is postback(automatically itself refresh)while i give a javascript for this event thats not working.
how to stop postback on clientclick of an imagebutton??
thank you
推荐答案
请参考以下链接,以更清楚地了解OnClientClick事件:-
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.onclientclick.aspx [ http://weblogs.asp.net/skoganti/archive/2004/10/24/246980.aspx [ ^ ]
如果您有帮助,请不要忘记将其标记为答案.
Please refer these links for more clarity on OnClientClick event:-
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.onclientclick.aspx[^]
http://weblogs.asp.net/skoganti/archive/2004/10/24/246980.aspx[^]
Please don''t forget to mark this as your answer if it helps you out.
您好,在页面加载中编写以下代码
Hi, Write below code in Page load
if(!isPostBack)
{
ImgExportPdf.Attributes.Add("onclick","javascript:return open_win();");
}
尝试一下
< asp:imagebutton id ="ImgExportPdf" height ="20px" imageurl =〜/images/pdf-icon.png" runat ="server"工具提示=导出为Pdf" onclientclick ="Javascript:return open_win(); "/>
< script type ="text/javascript">
函数open_win(){
window.open("Default3.aspx");
返回false;
}</script>
try this
<asp:imagebutton id="ImgExportPdf" height="20px" imageurl="~/images/pdf-icon.png" runat="server" tooltip="Export To Pdf" onclientclick="Javascript:return open_win();"/>
<script type="text/javascript">
function open_win() {
window.open("Default3.aspx");
return false;
} </script>
这篇关于OnClientClick事件未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文