SharePoint learning notes [6]-foundation of webpart

Source: Internet
Author: User
What is the difference between the Web Part in Asp.net and the Web Part in Moss? How to deploy webpart?
Moss2007 basics: Web Part in Windows SharePoint Services 3.0 [written by sunmoonfire]
Moss2007 basics: develop custom webpart [written by sunmoonfire]
Moss2007 basics: deploy custom webpart [written by sunmoonfire]
Walkthrough: SharePoint webpart Getting Started Guide 1 [written by Tu Shuguang]
Walkthrough: SharePoint webpart Getting Started Guide 2 [written by Tu Shuguang]
Walkthrough: SharePoint webpart Getting Started Guide 3 [written by Tu Shuguang]
Walkthrough: SharePoint webpart Getting Started Guide 4 [written by Tu Shuguang]
Walkthrough: SharePoint webpart Getting Started Guide 5 [written by Tu Shuguang]

Moss2007 basics: Web Part in Windows SharePoint Services 3.0
The most common way for developers to expand WSS 2.0 sites is to develop custom web components. Web parts are definitely a great invention because they allow us to add custom elements or personalize them on the page at will. Therefore, many MS or third-party companies have developed WSS 2.0-based custom web components.
Because of the success of Web Components in WSS 2.0, Ms decided to add support for custom Web Components in ASP. NET 2.0. This allows more developers to use this outstanding feature in their ASP. NET applications, and is completely isolated from the WSS 2.0 Environment.
Therefore, there are two different Web components. The old WSS-style webpart depends on Microsoft. Sharepoint. dll and must inherit from the webpart base class defined in WSS 2.0. Its namespace is Microsoft. Sharepoint. webpartpages. The new ASP-style webpart depends on system. web. DLL, which must be inherited from a different ASP.. NET 2.0 defines the webpart base class, and its namespace is system. web. UI. webcontrols. webparts.
One of you was absolutely happy. In WSS 3.0, you can use the old WSS-style webpart and the new ASP-style webpart. This is achieved by setting up the webpart supported by WSS 3.0 on the top-layer ASP. Net webpart structure and re-compiling Microsoft. Sharepoint. dll. In this way, the WSS 3.0 runtime environment will be compatible with the webpart specially compiled for WSS 2.0.
To explain how to load a webpart and run it in WSS 3.0, we will discuss how WSS 3.0 was re-designed and constructed on the basis of ASP. NET 2.0 webpart. I will go deep into WSS 3.0 to see how its Web Part pages are organized. In the following logs, we will study the details of defining webparts in WSS 3.0. (Please note)
To use webpart in an ASP. NET 2.0 application, you must create a. ASPX page that includes a webpartmanager control and at least one webpartzone control. The webpartmanager control serializes webpart-related data for access. You need to know that all the data is directed to the database of the ASP. NET service.
The. ASPX page can also include editor parts as a Web Part Page, which allows users to customize and personalize the webpart attributes. You can also include a catalog parts that allows users to add new webparts to the Web parts area. If you want to learn more about ASP. NET 2.0 types of internal function personalization and custom webpart content, refer to msdn. Http://msdn.microsoft.com/msdnmag/issues/05/09/WebParts)
The webpart in WSS 3.0 is based on a control named spwebpartmanager. It is derived from the webpartmanager control of ASP. NET 2.0. The spwebpartmanager control overrides many standard methods of the webpartmanager control, so that the webpart data is stored in the WSS content database, rather than in the ASP. NET Service database. Of course, we usually do not need to care about this. You only need to hand it over to the spwebpartmanager Control for processing, and this only requires a control instance that has been included in the master page default. the master is in progress, and the created content pages all inherit the master.
The other typical WSS 3.0web parts page controls include webpart zones, Editor parts, and catalog parts. Note that the webpart zones used on the WSS 3.0web parts page must be used by Microsoft. sharepoint. the webpartzone control defined in the webpartpages namespace is created instead of the standard ASP. NET 2.0.
An instance of the webpartzone control is usually defined on the Content Page. The following sample code shows how to create a content page and design it as a Web Part Page in WSS 3.0. As you can see, the. ASPX page is linked to the default. Master and inherited from the webpartpage base class. The placeholder placeholdermain contains two webpartzone controls.

<% @ Assembly name = "[fully qualified Microsoft. Sharepoint. dll name]" %>

<% PAGE Language = "C #" masterpagefile = "~ Masterurl/Default. Master "inherits =" Microsoft. Sharepoint. webpartpages. webpartpage "%>
<% @ Register tagprefix = "webpartpages" namespace = "Microsoft. Sharepoint. webpartpages" assembly = "[fully qualified Microsoft. Sharepoint. dll name]" %>
<Asp: Content contentplaceholderid = "placeholdermain" runat = "server">
<H3> my custom web parts page <Table border = "0" cellpadding = "3" cellspacing = "0">
<Tr>
<TD valign = "TOP">
<Webpartpages: webpartzone runat = "server" id = "Left" Title = "Left region"/>
</TD>
<TD valign = "TOP">
<Webpartpages: webpartzone runat = "server" id = "right" Title = "right region"/>
</TD>
</Tr>
</Table>
</ASP: content>
When we create a Web Part page in a standard ASP. NET 2.0 application, we must add the logic for interacting with the webpartmanager control to manage the webpart display mode. In general, we also need to explicitly add editor parts and catalog parts to the HTML layout of the page and make corresponding adjustments. However, if we are on the content page of WSS 3.0, we don't have to do this. We only need to inherit the webpartpage class from the Microsoft. Sharepoint. webpartpages namespace, so all these things can be done in the background. When the user enters the page editing mode, Editor parts or catalog parts automatically appears on the right side for the user to add the webpart to the Web Part area or change the existing webpart attributes.

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.