Web Parts

Web parts allow your users to reconfigure sections of your site to meet their own needs and preferences. Many information providers allow users to pick which content they want displayed and in which column to display it. Web parts allow you to provide that functionality with drag and drop “parts” of your page.

Web Parts Architecture

Web parts are created and managed on top of personalization using a structural component, called the WebPartManager control, to manage the interaction of web parts and UI controls to create user-managed interfaces.

Every web part page has a WebPartManager control. This invisible control tracks all the individual web part controls and manages the web part zones (described shortly). It also tracks the different display modes of the page, and whether personalization of your web part page applies to a particular user or to all users.

You’ll need to make sure the WebPartManager is placed at the top of the page. ASP.NET will throw an error if you run this page and the WebPartManager is declared lower in the source than any of the web parts that it is managing: between the form and div tags at the top of the page should be fine. For example:

<body>
   <form id="form1" runat="server">
      <asp:WebPartManager ID="WebPartManager1" runat="server" />
      <div>
         ... rest of page ...

The WebPartManager uses another ASP.NET provider, this time the AspNetSqlPersonalizationProvider, to store the current location of the contents in the web parts in your database. Like the providers ...

Get Programming ASP.NET 3.5, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.