from: http://windowsdevcenter.com/pub/a/windows/2006/01/10/what-are-web-parts.html

by Jesse Liberty

01/10/2006

Today's web application is customizable in ways that could only have been dreamed of five years ago. One significant aspect of enhancing the user's ability to customize a site is the ability for the customer to decide what information is displayed on a page, and where that information is located. Many of the most popular web sites are beginning to allow this kind of customization by their users, from Yahoo to high-end news and financial services applications like Charles Schwab.

Let's take a quick look at the "MyYahoo" page, in which I am offered the following choices as shown in Figure 1:

  • Add Content
  • Change Layout
  • Change Colors

You can create each of these options for your own users in a .NET 2005 application using Personalization, Web Parts, and Themes. This article will focus on Web Parts, and to see how they work, we'll build a simple application that allows the user to choose content and decide where it is placed.

What Are Web Parts?

Figure 1. My Yahoo customization

Begin by creating a new ASP.NET application named WebParts (or download the the complete project).

To get started, follow these steps:

  1. Open the Web Parts section of your Toolbox, and drag a Web Part Manager onto Default.asxp. (The job of the Web Part Manager is to track and coordinate all of the web part controls on the page. It will not be visible when the page is running.)
  2. Add a new table, with two rows and three columns. Rearrange the columns so that they are not of even size.
  3. Drag a Web Part Zone into each of the six table cells. In Design mode, click on each zone and re-size it to more or less fill the column. Your page should now look something like Figure 2:

What Are Web Parts?

Figure 2. Web Parts Design view--click for full-size image.

Your source at this point should look like this:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>WebZones</title></head><body> <form >http://www.codeplex.com/dropthings

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-02
  • 2021-07-06
  • 2021-08-05
  • 2021-05-28
  • 2021-11-07
猜你喜欢
  • 2021-06-03
  • 2022-12-23
  • 2022-01-04
  • 2021-05-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案