Chapter 11. Debugging User Controls

IN PREVIOUS VERSIONS OF ASP, IF YOU wanted to encapsulate sections of user interface code, you had limited options. You could use an include file, but there was no way to customize each “instance” of the code section.You could package the user interface code into a COM object and call one of its methods to display it, but that meant that you had to recompile the COM object each time you wanted to make a change. You could use a library of functions in script file includes, but this approach wasted a lot of web server resources because, most of the time, your page uses only a small subsection of the code in each include file.

In ASP.NET, User Controls solve this dilemma. User Controls are designed to give you the best of all worlds: encapsulation, optimized memory usage, compiled code, and the capability to make changes on the fly. With any aspect of programming, however, difficulties can emerge; this chapter deals with these difficulties. To make sure that we cover everything, the examples in this chapter follow the creation of a User Control and an ASP.NET page that consumes it from start to finish. Along the way, we’ll expose some of the nuances, technicalities, and omissions that crop up with User Controls.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset