How to use the Web Parts in asp.net 2.0

Source: Internet
Author: User
Tags contains range visual studio
Asp.net|web

Web Parts is a very interesting feature in asp.net2.0. It provides a range of available controls for creating dynamic Web interface, making it easy for users to configure or personalize pages. Users can display, hide, or move Web Parts components. Next, I'll give you a general overview of Web Parts.

Dividing pages

Microsoft SharePoint developers and users may be familiar with Web Parts, because Web Parts is a standard attribute in the SharePoint development environment. A WEB parts is a software component that controls part of a page. In asp.net2.0, the Web parts provides menus that users can use to control the actions of components, such as hiding, maximizing, editing, and so on.

A key concept to understand when dealing with Web Parts is the division of Web pages. In general, a page is divided into many parts, called regions. In asp.net 2.0, the layout design of the WEB parts is through regional control.

Control hierarchy

ASP.net 2.0 contains a number of controls. These controls are used when Web applications need to use Web Parts. WebPartManager is one of the most important controls that you need to use the Web Parts. For end users, this control is not visible, it is responsible for managing the personalization of the page and coordinating the communication between the Web Parts and the zone.

Each page that uses the Web Parts control set must contain a WebPartManager control, using the syntax of a WebPartManager control as follows:

<asp:webpartmanager id= "Webpartmanagerid" runat= "Server" >
</asp:WebPartManager>

WebPartZone is the next level of control. Serves as the primary control in the Web Parts control set to host WebPart controls on a Web page. WebPartZone is typically the second control that is added to the page (which requires multiple controls when multiple zones exist), which allows the user to specify a specific area in the Web table. The syntax for using a WebPartZone control is as follows:

<asp:webpartzone id= "Webpartzonename" runat= "Server" headertext= "Example" >
</asp:WebPartZone>

The WebPartZone control is used to define a range (or range) of the page, or you can add other controls to the WebPartZone control. Add a asp.net button control to the WebPartZone control (the sample contains the full page resource, also including the WebPartManager control).

This example contains three areas that are present on the page in the form of an HTML table (where the second area also contains a button control). This is a very simple example. You can also place arbitrary asp.net server controls in these areas. The WebPartManager control and the WebPartZone control are basic, and there are many other controls available.

Use Visual Studio

The easiest way to use a control is to develop the environment through Visual Studio. Visual Studio's toolbars contain webparts categories, which contain different controls that are available to the Web Parts in your program.

I've covered webpartmanager controls and WebPartZone controls, and many other controls that are available. The more important controls also have the following two categories:

    • CatalogZone: serves as the primary control in the Web Parts control set to host ASP.net server controls of type CatalogPart on a Web page. The CatalogZone control becomes visible only when the user switches the Web page to catalog display mode.
    • ConnectionZone: Sets the connection properties of the control. Allows the connection to be turned on/off. Enables dynamic connectivity between Web parts. The ProxyWebPartManager control enables static connections between Web Parts controls.

There are many other controls available, but this is beyond the scope of this article. In addition, you can develop your own controls. When a page uses Web Parts, you can use these controls to control different parts of the page.

Layout Web Parts

The Web Parts provides different patterns to control user interaction, including the following:

    • Browse mode : Default mode, also the standard way to use Web pages
    • design mode : Allows users to drag and drop Web Parts on the page. This pattern is always available.
    • edit mode : Allows the user to drag and drop the Web Parts, or select Edit to edit different aspects of the control. There are many editing controls that provide such functionality and can be viewed as an extension of design patterns
    • Catalog Mode : Allows the user to add additional controls through a defined list, CatalogZone control provides this functionality.
    • Connection mode: allows the user to establish communication between controls, which is provided by the ConnectionZone control.

These controls are available in asp.net. You can take different patterns in your application, depending on your needs.

More options

Web parts has been around for a long time in the SharePoint development environment, and now the asp.net2.0 version is starting to provide it. These controls make it easier for developers to create dynamic, personalized user interfaces and provide users with more choices. You can also develop your own controls to learn more about Web Parts.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.