Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between asp:button and html's button

Tags:

button

asp.net

I'm learning asp.net. I have question about example buttons

I can use two types of button.

   <input id="Button1" type="button" value="button" />

or

   <asp:Button ID="Button3" runat="server" Text="Button" />

What are the main differences between the two?

like image 569
nirmus Avatar asked Oct 11 '22 10:10

nirmus


1 Answers

One is a server control (the asp button) that when rendered on the page includes javascript that handles the postback logic, as well as being exposed to your code-behinds as a control you can address by its ID. The Html control is platform agnostic, and is rendered by your browser as just a button. That button will raise click events but will not POST your form.

like image 169
davecoulter Avatar answered Oct 14 '22 04:10

davecoulter