5.0 Introduction


User controls provide an excellent mechanism for code reuse in ASP.NET. Indeed, the reuse mechanism is better than the server-side include file method used in classic ASP. For one thing, user controls are compiled and can be cached separately from the page in which they are used, providing an increase in performance. (See Chapter 19.) For another, user controls leverage the object model support provided by ASP.NET, which means that you can program against any properties you declare for the control, just like other ASP.NET server controls.

This brings us to another point: user controls exist only on the server. When rendered and sent to the client, they are just part of the flat HTML for a page. Since they exist only on the server, browser compatibility is not an issue. It is unnecessary to download a control from the server to the client and, in the process, risk that a user might refuse to download a control needed to render your web page properly.



ASP. NET Cookbook
ASP.Net 2.0 Cookbook (Cookbooks (OReilly))
ISBN: 0596100647
EAN: 2147483647
Year: 2003
Pages: 202

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net