Background Information On User Controls

Overview : User Controls are user-developed controls that can cleanly encapsulate UI/Functionality.  They are implemented just like regular .aspx pages (except that you typically don't want to add a wrapping <html> or <body> tag around their content -- since they are typically used within another page).  Like regular .aspx pages, developers can sink the "Page_Load" and "Page_Unload" events as well as utilize server controls within them.

User Controls are used from another page by "registering" a unique prefixed tag to the source location of the user control file.  This is accomplished using a "Register" page directive at the top of a .aspx file.  For example:

<%@ Register TagPrefix="AdventureWorks" TagName="Menu" Src="_Menu.ascx" %>

They can then be declared and used as a server control within the page:

<AdventureWorks:Menu id="Menu1" runat="server" />

Note that all public properties/fields declared within the code portion of a user control are programmable from the page on which it is used (a page developer would use the "id" attribute of the user control to set the properties -- for example: MyMenu.SourceFile="Default.src").  These properties/fields can also be declaratively set.  For example:

<AdventureWorks:Menu id="MyMenu" SourceFile="Default.src" runat="server" />

Look at the source of different pages within the Adventure Works Cycles application to see how the Header, Menu, ReviewList, AlsoBought and PopularItems user controls are being used.