HTML Server Control or HTML Element in aspx page?

By Santhosh N

This explains about the best possible way to handle the controls in aspx page depending on the functionality.

First let us examine what is a HTML Server Control and normal HTML Element in an aspx page.


Any HTML input controls with runat=”server” attribute is a server control and which does not have this attribute is a normal HTML Element.


HTML Input Server Control : <input id="Text1" type="text" runat="server"/>
HTML Input Element: <input id="Text1" type="text"/>



Now, the question is when to go for Server control and when not required in aspx page:


The answer is simple: When you are not required to call the control instance (control value) from code behind file, you can simple remove the runat=”server” attribute and make the control as pure HTML element. This reduces the resources to be used up in the page as server control uses up additional resources when compared to normal HTML Elements in the page.

Related FAQs

This explains the equivalent of global.asa of classic ASP in Asp.Net
This explains about the co-existence of ASP and ASP.Net websites in the same server
This explains the equivalent of ObjectRecordSet.MoveNext ofclassic ASP in Asp.Net
HTML Server Control or HTML Element in aspx page?  (1070 Views)