How to Use ASP.NET 4 User Controls
User controls are great for encapsulating markup, controls, and code that you need repeatedly throughout your site. To some extent, they look a bit like server controls in that they can contain programming logic and presentation that you can reuse in your pages. However, rather than dragging existing ones from the VWD Toolbox, you need to create your own user controls and then add them to your ASPX pages, as you learn how to do later in this chapter.
Though master pages enable you to create content that is displayed in all pages in your site, it’s common to have content that should appear only on some but not all pages. For example, you may want to display a banner on a few popular pages, but not on the home page or other common pages. Without user controls, you would add the code for the banner (an image, a link, and so on) to each page that needs it. When you want to update the banner (if you want to use a new image or link), you need to make changes to all pages that use it. If you move the banner to a user control and use that control in your content pages instead, all you need to change is the user control, and the pages that use it pick up the change automatically. This gives you a flexible way to create reusable content.