ASP.NET
and HTML buttonsA button is a clickable element that enables users to trigger particular tasks or functions on a website.
While ASP.NET
and HTML
use the button element, they have some notable differences.
ASP.NET
Here's how a button is declared in ASP.NET.
<asp:button Text="Click Here!" runat="server"/>
Here's how a button is declared in HTML
.
<button>Click Here!</button>
While the syntax of both buttons is similar, as the ASP.NET
button starts with the asp:button
tag and requires a runat
property to make it work on the server side.
ASP.NET button | HTML button |
It is a server-side button. | It is a client-side button. |
It posts the form it is contained in and runs postback logic. | It does not have a postback logic |
It is relatively heavy, as it posts the server every time it is clicked. | It is lightweight, as it only raises click events. |
Not recommended for client-side logic. | Recommended for client-side logic like validation. |
The postback logic is contained in a seperate | The event handler logic may be contained in a |
Free Resources