Net-informations.com
SiteMap  | About    

Button Control

Button control displays a push button control on the Web page. By default, a Button control is a Submit button. You can provide an event handler for the Click event to programmatically control the actions performed when the Submit button is clicked.

button-control
vb.net
  Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
	Label1.Text = "Button Clicked !!"

End Sub

C#
  protected void Button1_Click(object sender, EventArgs e)
  {
	Label1.Text = "Button Clicked !!";

}

The following ASP.NET program display a text in the label when the Button click event is performed.

Default.aspx

  

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
	<title>Untitled Page</title>
</head>
<body>
	<form id="form1" runat="server">
	<div>
	   <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
	   &nbsp;
	   <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
	</div>
	</form>
</body>
</html>


Click the following links to see full source code

C# Source Code
VB.NET Source Code
default.aspx.cs
default.aspx.vb





net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.