ASP. NET Button control
The Button control is used to display a Button.
Button control
The Button control is used to display a Button. This button may be a submit button or command button. According to the preset, this control is a submit button.
When a web page with the submit button without command name or position is returned to the server, click. The commit button may be pressed when an event handler is written to control the action.
The command name of a command button and allow you to create multiple button controls on the page. The command button may be pressed when you write an event handler to control the action.
The network control reference page lists the properties and properties of the Button control.
The following example shows a simple button control:
<Html> <body> <form runat = "server"> <asp: Button id = "b1" Text = "Submit" runat = "server"/> </form>
</Body>
Add script
Click the button most frequently when submitting a form.
In the following example, we declare a TextBox control, a Button control, and a Label control.
Aspx file. When the submit button is triggered, submit the subprogram for execution. Submit the sub-program to write a text label control:
<Script runat = "server"> Sub submit (sender As Object, e As EventArgs) lbl1.Text = "Your name is" & txt1.TextEnd 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>