日期:2014-05-19  浏览次数:20542 次

怎么去掉button默认的提交行为
<form   id= "form1 "   runat= "server "   onsubmit= "return   checkdata() ">
<asp:Button   ID= "Button2 "   runat= "server "   UseSubmitBehavior= "false "   Text= "检查用户名是否可用 "   >
每次点击,都会触发checkdata(),设置UseSubmitBehavior= "false "不起作用,请高手回答

------解决方案--------------------
给它注册一个Click客户端事件,在这个事件里return false应该可以吧.
------解决方案--------------------
Button2.Attributes.Add( "onclick ", "return false; ");
------解决方案--------------------
<asp:Button ID= "Button2 " runat= "server " OnClientClick= "return false " UseSubmitBehavior= "false " Text= "检查用户名是否可用 " />