WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

ASP.NET Web Forms - The Button Control


The Button control is utilized to show a push button.


The Button Control

The Button control is utilized to show a push catch. The push catch might be a submit catch or an order catch. As a matter of course, this control is a submit button.

A submit catch does not have an order name and it posts the page back to the server when it is clicked. It is conceivable to compose an occasion handler to control the activities performed when the submit catch is clicked.

A order catch has a direction name and enables you to make various Button controls on a page. It is conceivable to compose an occasion handler to control the activities performed when the order catch is clicked.

The precedent underneath shows a straightforward Button control:

<html>
<body>

<form runat="server">
<asp:Button id="b1" Text="Submit" runat="server"/>
</form>

</body>
</html>

Add a Script

A structure is regularly put together by tapping on a button.

In the accompanying precedent we announce one TextBox control, one Button control, and one Label control in an .aspx document. Whenever the submit catch is set off, the submit subroutine is executed. The submit subroutine composes a content to the Label control:

Example

<script runat="server">
Sub submit(sender As Object, e As EventArgs)
lbl1.Text="Your name is " & txt1.Text
End Sub
</script>

<html>
<body>

<form runat="server">
Enter your name:
<asp:TextBox id="txt1" runat="server"/>
<asp:Button OnClick="submit" Text="Submit" runat="server"/>
<p><asp:Label id="lbl1" runat="server"/></p>
</form>

</body>
</html>