Difference in Web server Controls and HTML Server Controls

G

Guest

Hello All,
Can any one give me a clue when to use Web Server controls/ HTML server
controls/HTML Controls. As I understand ..
HTML controls should be used if u dont need to refer it in the code behind
a(simply bcaz it is not recognized in the code behind IDE) and it does not
make a server trip.
HTML server Controls should be preferred over Web Server controls as they
are light weight than ASP.NET web Server controls.(If they have same
performance why ever use HTML server controls??)
Web Server controls should be used only when that control is not there in
HTML server control...like calender control,datagrid)

any suggestion wil be appreciated..



Cheers,
siaj
 
K

Karl Seguin

Siaj:
I'd say you are right about plain-jane HTML controls...they are useful when
you don't need them on the server.

The real question is when to user html server controls and web server
controls.

First, the most obvious answer is when you don't have a choice. For example
there's nothing like the repeater/datagrid/datalist/calendar/... in html
server controls so you don't really have a choice. Also, there's nothing
like an input type="file" for web server controls so you have to use the
html server control.

However, html server controls partly exist just to help developers migrate
to ASP.Net because all you need to do is add an id and a runat="server" and
you are up and running. If you are starting a project from scratch, I'd
always prefer web server controls because they provide greater flexibility.
I wouldn't let any performance differences (if there are any) be a factor
because I'd expect it to be extremely small if anything..

(gonna add this one to the FAQ I think)

Hope that helped,
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
 
E

Eliyahu Goldin

HTML controls should be used if u dont need to refer it in the code behind
a(simply bcaz it is not recognized in the code behind IDE) and it does not
make a server trip.
Not true. You can always add runat=server to any html and it will be
recognized on server.
HTML server Controls should be preferred over Web Server controls as they
are light weight than ASP.NET web Server controls.(If they have same
performance why ever use HTML server controls??)
Should be true. Not aware of any figures though.
Web Server controls should be used only when that control is not there in
HTML server control...like calender control,datagrid)
Not only. Web controls inherit from another class. They have different set
of members. You might prefer them just because you like their members. They
also more consistent between themselves.

Eliyahu
 
T

Tampa.NET Koder

Has anyone done any testing with this? I am not sold on the fact that HTML
Controls that are marked with runat="server" is more efficient that using
the web server controls. All controls marked with this attribute is
compiled along with your page class and I don't see where performance would
come into play. I'm sure someone with more time on their hands than I , have
done some benchmark testing. :)
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top