HTML control Vs Web form control

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
 
E

Eliyahu Goldin

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
 
K

Kevin Spencer

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top