Question

As I put together each asp.net page Its clear that most of the time I could use the standard html tags just as easily as the webforms controls. When this is the case what is the lure of the webforms controls?

Was it helpful?

Solution

HTML controls will be output a lot faster than server controls since there is nothing required on part of the server.. It just literally copies the markup in the ASPX page.

Server controls however require instantiation.. Parsing of the postback data and the like, this is obviously where the work comes in for the server.

The general rule of thumb is:

If its static (i.e. you dont need programmatic support), make it a HTML control. HTML controls can easily be "upgraded" to server controls so there is no real issue of maintanence at a later time.

OTHER TIPS

Webform controls have more server-side pre-built functionality (server side hooks, methods and attributes), I tend to use HTML controls only when I require a high degree of formatting (styling) as that bypasses the way .Net renders it's controls (which, at times, can be very strange).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top