Introduction

     

User controls provide an excellent mechanism for code reuse in ASP.NET. Indeed, the reuse mechanism is significantly 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 a significant increase in performance. (See Chapter 13.) 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. Because they exist only on the server, browser compatibility is not an issue. Nor is it necessary 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 properly render your web page.



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

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