What is the difference in functionality between
<asp:Button id="button1" Text="Click me" runat="server" OnClick="submitEvent" />
and
<input type="button" id="button1" runat="server" value="Click me" />
Does the input with runat="server" attribute has other or limited properties and methods?
Thank you!
The first one creates a System.Web.UI.WebControls.Button
while the second one creates a System.Web.UI.HtmlControls.HtmlInputButton
.
Both are server controls, but the controls in the WebControls
namespace generally has a bit more functionality than the controls in the HtmlControls
namespace. Typically they put some data in ViewState
to keep track of their state, and they have server side postback events.
Each controls in the HtmlControls
namespace correspond exactly to an HTML element, while the controls in the WebControls
namespace may be rendered differently depending on what the browser that is requesting the page can support.