ASP.NET 2.0 Tutorials
Tutorials
ASP.NET 2.0ASP.NET 2.0 Training : Working with Web Parts
Table of Contents
ASP.NET 2.0 Training : Working with Web Parts
ASP.NET 2.0 Training : Working with Web Parts - Page 2ASP.NET 2.0 Training : Working with Web Parts - Page 2
To create a new Web site using WebParts
1. In Visual Studio, create a new ASP.NET Web site.
2. If additional settings have to be configured on the website, select the Website menu and choose ASP.NET Configuration. This opens the ASP.NET Web Site Administration Tool, and provides access to various administration settings.

Let us create a simple page using web parts to better understand the concepts.
The Web.config File
When working with Web Parts it is important to have an authenticated user system. The Web.config file can be modified to ensure that the login of the user is required to access the home page of the portal. However, personalization features can work with anonymous users as well if the personalization features are activated.
Open the Web.config file and enter this code.
Click here to view sample code
Adding the WebPartManager Control
The WebPartManager Control has no visibility at runtime and hence can be placed anywhere on the page.

However, for sake of convinience it can be place in the head of the page between the head tags. This will ensure that it is available but does not disturb the layout of the page. In combination with master pages this becomes a great advantage, as it can be placed once and used on several pages. The following code is displayed when the WebPartManager Control is placed on a page. It must be noted that only one WebPartManager control can be placed per page.
< html xmlns="http://www.w3.org/1999/xhtml"" target="_blank" rel="nofollow"; >
< head runat="server" >
< title > Untitled Page < /title >
< asp:WebPartManager ID="WebPartManager1" runat="server" >
< /asp:WebPartManager >
< /head >
This section is a conceptual introduction on Web Parts and its uses. In the next section we shall see how these concepts can be applied to a Web page to create dynamic, user friendly pages.
First Page: ASP.NET 2.0 Training : Working with Web Parts
Comments
michael galloway said:
| :-\\ :-\\where is the rest of this article - am i being stupid or does this just show you how to drag and drop a weppartsmanger onto your page :P |
Kimmo said:
| ;D Look below comments. There you see Prev and Next buttons =) |
JJV said:
|
Hello , I am trying to customize to Oracle provider using forms authentication. The LoadPersonalizationBlob,SavePersonalizationBlobs are important methods to load and save the changes. It works fine with Windows authentication. But its not persisting with Form authentication when the WEBPARTS ARE ADDED THROUGH CODE.. Can anybody help me |
eric said:
| great article! keep it coming |
