js 调用asp.net控件事件

=====================================前台代码

<input type="button" onclick ="aa();" value="点击" />
<script type="text/javascript">
function aa() {
var bu = document.getElementById("Button1");
bu.click();
}
</script>
<asp:Button ID="Button1" runat ="server" OnClick ="button1_click" />

 

=====================================后台代码

protected void button1_click(object sender, EventArgs e)
{
ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert(‘对不起,没有此人!!!‘)</script>");
}

访问修饰符是protected 或public

本文出自 “程序猿的家” 博客,请务必保留此出处http://962410314.blog.51cto.com/7563109/1384183

js 调用asp.net控件事件,布布扣,bubuko.com

js 调用asp.net控件事件

上一篇:jsp运行机制


下一篇:8,mongodb 的导入和导出