Preparing to Add Web Parts

Web portal technology has introduced us to the concept of writing very small Web applications that can be managed by a separate portal application. In the past, portal management functionality—e.g., the ability to control access to portal areas, customizing each user's experience, etc.—required you to purchase portal software such as Microsoft SharePoint Portal Server, which has a framework to manage Web parts.

VWD ships with a comprehensive new Web part management system very similar to SharePoint. Personalization is supported out-of-the box, allowing users, among other things, to drag and drop Web parts on a page. To support this functionality VWD provides the application glue on top of ASP.NET.

In this chapter you will explore how to build Web pages with the Web part controls that ship with VWD.  To begin using Web parts, you must first place the proper Web part controls on your page.

1.  Create a new Web form in your project called WebParts.aspx. Do not use a master page but do use a separate code-behind file. You will need the latter to handle the Web Part mode switching in the next lesson.

2.  From the ToolBox drag a WebPartManager control onto the WebParts.aspx design surface. In the Properties window set the ID property to "authorsWebPartManager".

The WebPartManager control manages all the Web parts on the page. Each page that uses Web parts must have this control.

3. Place your cursor below the WebPartManager control and then select Layout | Insert Table menu command to add a single-row, 3-column table to the page, as you see below. Also, click Cell Properties and then for Vertical align select top.

A WebPartZone control is a container for one or more Web Parts. You must add these containers to add Web Parts.

4. Drag a WebPartZone control into the first column of the HTML table. Set its ID property to "leftColWebPartZone".

5.  Drag a second WebPartZone control into the second column of the HTML table. Set its ID property to "midColWebPartZone".

6.  Add the following element to the web.sitemap file: <siteMapNode url="WebParts.aspx" title="Web Parts" description=""  />.

You are now ready to start adding Web Parts to your page.

 
HyperLink HyperLink

Powered By ASP.NET v2.0