By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,636 Members | 1,693 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,636 IT Pros & Developers. It's quick & easy.

Difference in Web server Controls and HTML Server Controls

P: n/a
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
Nov 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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!)
"siaj" <si**@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
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

Nov 19 '05 #2

P: n/a
> 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
Nov 19 '05 #3

P: n/a
Another point to see - of course, you can club it under server-side
support:

Availability of numerous eventhandlers! That really a big plus.
--
Cheers,
Gaurav Vaish
http://www.mastergaurav.org
http://mastergaurav.blogspot.com
---------------------------

Nov 19 '05 #4

P: n/a
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. :-)
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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

Nov 19 '05 #5

P: n/a
Thanks a lot...

"Steve C. Orr [MVP, MCSD]" wrote:
HTML controls are lighter weight, while web controls are more powerful.
Like everything in programming, it's a trade off.

Here are more details:
http://SteveOrr.net/faq/3in1.aspx#HTMLvsWeb

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"siaj" <si**@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
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


Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.