中国搜 程序源代码学习 编程源代码 直接应用在编程实践中 优秀编程书籍源码欣赏

收藏本页到>> 新浪ViVi  365Key网摘   IE收藏夹 |设为首页

 中国搜首页 >>ASP.NET相关>>Button的Click事件 C#版

代码说明: 当按钮被包含该按钮的表单被提交,并且发出Click和Command事件。Click和Command事件之间的差别在于附加信息:CommandName和CommandArgs被传递给Command事件。
    下面的演示程序中,btnCounter_Click子程序与Button控件的Click事件相关联。该子程序把Button的Text属性增加1。

<Script Runat="Server">

Sub btnCounter_Click( s As Object, e As EventArgs )
btnCounter.Text += 1
End Sub

</Script>

<html>
<head><title>Button.aspx</title></head>
<body>

<form Runat="Server">

<asp:Button
id="btnCounter"
text="1"
OnClick="btnCounter_Click"
Runat="Server"/>

</form>

</body>
</html>


   运行演示程序   

  ©2004   www.zhonguosou.com