为什么页面回发在按钮中单击 [英] why the page is postback in the button click

查看:83
本文介绍了为什么页面回发在按钮中单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单击按钮时,页面将被回发,并且按钮也会触发click事件,对于其他控件(如文本框),我将自动回发设置为true,那么只有它可以进行回发和事件触发.按钮控件自动获取回发,它具有获取回发和事件的特殊属性.

Hi when i click the button, the page is postback and the click event is also fired for button, for the other control like textbox i''m giving the autopostback true, then only it gets postback and event fire.. But The button control is automatically get postback it has which special property to get the postback and event fire

推荐答案

在ASP.NET中,默认情况下,带有runat ="server"的按钮是启用回发.但是,要禁用回发,您需要编写OnClientClick ="return false;".在按钮上.

希望有帮助!
In ASP.NET by default button with runat="server" is postback enabled. However, for disabling postback you need to write OnClientClick="return false;" on the button.

Hope this help!


这篇关于为什么页面回发在按钮中单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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