Personalizing Using Web Parts->Introducing Web Part Controls


Introducing Web Part Controls

The Web Part Control Set includes the following controls:
  • Web Parts are ASP.NET server controls that can be used and personalized with the Web Part Control Set. Any ASP.NET server control or user control can behave as a web part.
  • Web Part Zones provide a way to organize parts into regions on the page. Zones are container controls that provide layout for parts, and add common, consistent UI elements such as a Verb Menu and border to each part.
  • The WebPartManager control manages the pages personalization state, and co-ordinates communication between parts and zones. Every page that uses the Web Part Control Set must have a WebPartManager control on it.
The following code shows a web part zone with a single part. The parts in a zone are contained in the zone's ZoneTemplate.

<asp:WebPartZone ID="WebPartZone1" Runat="server">
<ZoneTemplate>
<asp:Calendar Runat="server" ID="Calendar1"/>
</ZoneTemplate>
</asp:WebPartZone>
This example shows a simple page that uses web parts. It includes a WebPartManager control, a WebPartPageMenu control, and two web part zones. One of the zones contains an ASP.NET Calendar control.
  1. Log in to the page.
  2. Select "Design" from the menu's DropDownList.
  3. Move Web Parts to different WebPartZones.
  4. Close the browser, and run the sample again. You will see your personalized changes have been applied.
VB Web Parts and Zones

Web parts pages can also contain web parts that are not visible by default. The user can add these parts to the page through a web part catalog. A web part catalog allows you to define optional content not visible by default on the page.

To provide a catalog on the page, you need to add a special zone control, called the CatalogZone, to your page. In this zone, you can add catalog parts that provide different kinds of controls. This example shows a page with a CatalogZone containing a PageCatalogPart, which provides a catalog of all closed web parts defined on the page.
  1. Log in to the page.
  2. Click the dropdown arrow on the control's verbs Menu then click the Close verb on the calendar to close the Web Part.
  3. Select "Catalog" from the menu's DropDownList.
  4. Check the checkbox next to the part named "Untitled", and click the Add button. The calendar will be added back to the first zone.
VB Web Part Catalogs

In addition to allowing users to personalize the layout and visibility of web parts on a page, you can also let users edit properties of each web part. Every part has a set of default properties that can be personalized. Each control can also provide additional properties to be personalized.

To allow editing of control properties, you need to add a special zone control, called the EditorZone, to the page. To this zone, you can add one or more editor parts. The following editor parts are provided:
  • The AppearanceEditorPart control allows users to edit the visual appearance of a web part.
  • The BehaviorEditorPart control allows users to edit behavior properties of a web part.
  • The LayoutEditorPart control allows users to edit the layout of a web part.
  • The PropertyGridEditorPart control displays a property grid that allows users to edit custom personalizable properties for a web part.
You can also create your own custom editor parts by inheriting from the EditorPart base class.

This example shows a page with an EditorZone containing an AppearanceEditorPart.
  1. Log in to the page.
  2. Select "Edit" from the menu's DropDownList.The editor will now be visible.
  3. Click the Edit Verb on the calendar's Verbs Menu to edit the Web Part.
  4. Edit the title in the editor, and click OK. The title of the calendar will now be updated.

长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号





    联系我们

    欢迎来到TinyMind。

    关于TinyMind的内容或商务合作、网站建议,举报不良信息等均可联系我们。

    TinyMind客服邮箱:support@tinymind.net.cn