Introduction
ASP.NET is an open-source web framework that works on the server-side to produce dynamic web pages using HTML, CSS, JavaScript, TypeScript. ASP.NET supports web forms, validation, event handlers, file handling, etc.
You might have observed a button at the end of any form with the text “Submit”. But do you know that these buttons are of two types? Yes, the buttons we use to submit a form are of two types; submit button and the command button. Let’s learn more about these buttons in this article.
Button Control
The button controls are used to display the push buttons. The pushbutton is of two types; submit and command buttons.
Submit button - The submit button posts the data and page to the server. It doesn't have a command name, and the event handlers handle the actions on click.
Command button - The command button allows you to create multiple button controls for a page and has a command name. It also enables you to handle the actions using event handlers. You can also use the CommandArgument property to add additional information about the command.
Let’s take the example of simple button control.
<html>
<body>
<form runat="server">
<asp:Button id="b1" Text="Submit" runat="server" Tooltip="Submit"/>
</form>
</body>
</html>
We created a basic submit button in the above code using the asp: Button tag. It works when we click on it when provided with a code in the script file.
Also see, Introduction to C#