there are 2 different categories of controls in asp.net2.0, the HTML controls and WebServer controls, what are the differences in terms of usage?
or in what circumstances each of these 2 categories should be used?
The HTML controls are primarily used when porting old ASP applications (or plain HTML) pages to ASP.NET. They are also sometimes used when you want to write large amounts of client-side JavaScript.
The ASP.NET server-side controls are used when you want to write server-side code to get/set the values of the controls (but bear in mind that they render as standard markup, so you can also program against them on the client if you want).
The ASP.NET controls offer a much cleaner and consistent object model for programming (on the server), whereas the HTML controls (when marked with runat="server") provide a less consistent model. For example, an ASP.NET TextBox is used to represent text, textarea and password input controls, just by setting its TextMode property.
The ASP.NET controls are also great when used in conjunction with validation controls.
Finally, ASP.NET controls remember there state between round-trips. The HTML controls do not, so you either have to set their values or mark them with runat="server" to give them a server-side presence so that ASP.NET can reset their state for you.
Consequently, the ASP.NET controls should be used in by far the majority of cases.
Try this:http://www.odetocode.com/Articles/348.aspx
Hope that helps.
Aaron
No comments:
Post a Comment