Asp.net按钮单击避免页面加载 [英] Asp.net button click avoid page load

查看:85
本文介绍了Asp.net按钮单击避免页面加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有asp按钮我想避免点击按钮上的页面加载



我尝试过:



我用过autopostback,onclientclick

解决方案

在你的Aspx文件中使用OnClientClick



< asp:Button1 runtat =serverOnClientClick =return false



或者如果您想在代码隐藏文件中处理它,那么你应该将此属性添加到按钮:例如



 Button1.Attributes.Add(onclick,return false;); 


I have asp button I want avoid pageload on button click

What I have tried:

I have used autopostback,onclientclick

解决方案

In your Aspx file use OnClientClick

<asp:Button1 runtat="server" OnClientClick="return false"

Or if you want to handle it in your code behind file then you should add this as a attribute to your button: like

Button1.Attributes.Add("onclick", "return false;");


这篇关于Asp.net按钮单击避免页面加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆