Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Day 6.  Learning More About Web Forms



How is user control processing different from ASP.NET page processing?


Actually, user control processing is very similar to ASP.NET pages. Upon first request, they're compiled, just like .aspx files. They can also contain Page_Load event handlers! When a Page_Load event handler exists in both a user control and an ASP.NET page, the latter is handled first. All other events are handled in the same order as if they were contained within the ASP.NET page.


What's the difference between a user control and a code-behind form?


If you've been experimenting with ASP.NET, you may have heard of code-behind forms. The distinction between the two is often confusing for beginners. A user control encapsulates a user interface and its functionality for reuse in other applications. A code-behind form is a class that declares objects and their methods for use in an .aspx file, without any user interface elements.

It may help to think of a user control as a puzzle piece you can use it to build a larger picture of the UI. It already contains a piece of the picture, and it knows how to handle itself once it's put in place. A code-behind form, then, is the parent of an .aspx file (literally). It tells the .aspx file what it can do and how to do it, without telling it how it should look.


    Sams Teach Yourself ASP. NET in 21 Days
    Sams Teach Yourself ASP.NET in 21 Days (2nd Edition)
    ISBN: 0672324458
    EAN: 2147483647
    Year: 2003
    Pages: 307
    Authors: Chris Payne

    Similar book on Amazon © 2008-2017.
    If you may any questions please contact us: