O'Reilly logo

Programming ASP.NET 3.5, 4th Edition by Jesse Liberty, Dan Hurwitz, Dan Maharry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required