Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help on Controls

Status
Not open for further replies.

jerjim

Programmer
Jan 4, 2001
85
PH
In going through the Microsoft QuickStart tutorials, particulary the Web Controls Reference, one can see that the controls are grouped into HTML server controls (System.Web.UI.HtmlControls) and Web Server Controls (System.Web.UI.WebControls). Both set of controls have a lot of common elements such as Button, TableCell, etc.

My question is NOT what's the difference but when is it best to use one group or the other.

Many thankx in advance.
 
Hey Jer,

You would want the html controls when processing is not needed at the server level. For instance, maybe you have a link on your page that (for whatever reason) you want the user to click a button to access, which will bring up the page in a new window. There's no need for a trip to the server to process that, so you could use the html button control and a bit of javascript to open it up.

However, lets say you wanted to save some data on the butotn press, and that would mean that some functions in your code behind would have to be used. This means that a trip to the server is needed, so you'd use an asp.net button control instead.

In short, if you need something to happen that really doesn't require server resources, use HTML controls. Otherwise, use the asp.net set.

Jack
 
Oh, one other thing:

All asp.net controls do is render html to the browser, just in a nice way.

However, the asp.net controls aren't great when you need to format the look on some of them. For instance, if you're trying to use a panel control to make stuff line up, it can be hell! We ran into this, and ended up dropping in an html table control, which fixed the formatting issues right away.

So the html controls are also helpful if you need visual formatting, and other areas that asp.net controls lack.

Jack
 
Thanks JFrost. Going through all the documentation, trying to absorb everything about .Net and then taking hours just to find a sentence that will clarify a nagging doubt.

Thank God for Tek-Tips and JFrost.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top