当使用System.Web.UI.WebControls.Button时,如果该页面有检验控件(如RequiredFieldValidator),则会进行校验,如果页面还有ValidationSummary以及ValidationSummary.ShowMessageBox为true时,则会弹出提示,加上下面一句即可跳过该提示:
button.Attributes["onclick"] = "return;";
当然也有别的办法,比如把Button直接写成:
<input type="submit" name="Button1" value="Button" οnclick="dosomething();"/>
button.Attributes["onclick"] = "return;";
当然也有别的办法,比如把Button直接写成:
<input type="submit" name="Button1" value="Button" οnclick="dosomething();"/>