HTML control Vs Web form control

  • Thread starter Thread starter Bhuwan Bhaskar
  • Start date Start date
B

Bhuwan Bhaskar

Hi,

I am new to asp.net. I want to know that, HTML and Web form control can work
in same way example, using "runat = Server" attribute, html control can also
executed at server, then what is the use of HTML control and is there is any
specific condition when we use only HTML control or web form control.

Thanks and regards,
Bhuwan
 
Html controls are lighter. One of typical scenarios where you may want to
use html controls is when you have an html prototype of your page and you
need to program it in asp.net. Then it is easier just to add runat=server to
html controls.

Web controls offer common set of server-side members that can make your code
cleaner and more readable.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
As Eliyahu said, HtmlControls are more lightweight, but it is important to
understand what the differences are in order to know what you need to use.
All HtmlControls are derived from System.Web.UI.HtmlControls.HtmlControl,
and all WebControls are derived from System.Web.UI.WebControls.WebControl.
Give the following MSDN references to these 2 base classes a read, and you
should be well-informed:

http://msdn2.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmlcontrol.aspx
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.webcontrol.aspx

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

Eliyahu Goldin said:
Html controls are lighter. One of typical scenarios where you may want to
use html controls is when you have an html prototype of your page and you
need to program it in asp.net. Then it is easier just to add runat=server
to html controls.

Web controls offer common set of server-side members that can make your
code cleaner and more readable.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Bhuwan Bhaskar said:
Hi,

I am new to asp.net. I want to know that, HTML and Web form control can
work in same way example, using "runat = Server" attribute, html control
can also executed at server, then what is the use of HTML control and is
there is any specific condition when we use only HTML control or web form
control.

Thanks and regards,
Bhuwan
 
Back
Top