Andrew Connell [MVP MOSS]
1418 Posts |  40 Articles |  3755 Comments
.NET  |  MCMS  |  SharePoint  |  Office System
SharePoint Quick Links
Article Categories
Archives
Post Categories


Add to Technorati Favorites

This post expands on a small tidbit I mentioned at the end of another post a few days ago.

Web Parts were first introduced in Windows SharePoint Services v2. The concept was so compelling that the model was improved and added to the second generation of ASP.NET: ASP.NET 2.0. This wasn't the only addition to ASP.NET 2.0. Other improvements and enhancements allowed the Windows SharePoint Services team to revamp their underlying architecture that resulted in it being rebuilt on top of ASP.NET 2.0 (previously, WSS v2 had it's own rendering engine).

With these two significant events (Web Parts -> ASP.NET 2.0 & WSS v3 being built on top of ASP.NET 2.0), now ASP.NET 2.0 Web Parts will work within WSS v3 websites. However, that's not the end of the story... not only can you build Web Parts that derive the ASP.NET 2.0 WebPart class (System.Web.UI.WebControls.WebParts.WebPart), but you can also build Web Parts that derive the WSS v3 WebPart class (Microsoft.SharePoint.WebPartPages.WebPart). The WSS v3 WebPart class is actually derived from the ASP.NET 2.0 WebPart class.

"Why do you have two WebPart classes?" According to the Windows SharePoint Services v3 SDK:

The Windows SharePoint Services (version 3) WebPart class has been rebased to inherit from the Microsoft ASP.NET 2.0 WebPart class, providing a compatibility layer to ensure that Web Parts written for Windows SharePoint Services (version 2) work in Windows SharePoint Services V3 without modification. It exists primarily for the purpose of backward compatibility, and secondarily, to provide a small set of features that are not available in the ASP.NET WebPart class.

"So I ~only~ use the WSS v3 WepPart class when I'm upgrading a WSS v2 Web Part derived from the WSS v2 WebPart class? Otherwise, only build Web Parts derived from the ASP.NET 2.0 class?"  No... not exactly. There are four cases when you should use the WSS v3 WebPart class over the ASP.NET 2.0 WebPart class... according to the SDK:

  • Cross page connections
  • Connections between Web Parts that are outside of a Web Part zone
  • Client-side connections (Web Part Page Services Component)
  • A data caching infrastructure that allows caching to the content database

Now we are left with three different WebPart classes: (1) WSS v2, (2) ASP.NET 2.0, and (3) WSS v3. As you'd expect, none are the same. However, the ASP.NET 2.0 WebPart class was based off the concepts of Web Parts in WSS v2, so there's likely to be quite a few similarities. In addition, the SharePoint team went to significant lengths to make sure WSS v2 WebParts would work in WSS v3, thus many members were added to the WSS v3 class for backwards compatibility. There are also a handful of new members that were added to the WSS v3 WebPart class.

The table below outlines the additional members you'll find in the WSS v3 WebPart class (Microsoft.SharePoint.WebPartPages.WebPart) from the ASP.NET 2.0 equivalent(System.Web.UI.WebControls.WebParts.WebPart [MSDN documentation link here]) and those that have been retained for backwards compatibility with the WSS v2 WebPart class (I've omitted the members inherited from it's derived ASP.NET 2.0 WebPart class and those that were retained from the WSS v2 class (MSDN documentation link here).

Everything listed in the table below is from the WSS v3 Beta SDK. Obviously it is subject to change.

Public Fields
Public Field Static LimitOneConnection Specifies that a connectable Web Part can accept no more than one connection to another Web Part. 
Public Field Static UnlimitedConnections Specifies that a connectable Web Part can accept an unlimited number of connections to another Web Part. 
Public Properties
Public Property SerializedAttachedPropertiesShared Supports the Windows SharePoint Services Web Part connection infrastructure. Not intended to be used directly from your code.
Public Property SerializedAttachedPropertiesUser Supports the Windows SharePoint Services Web Part connection infrastructure. Not intended to be used directly from your code.
Protected Properties
Protected Properties CacheType Determines the type of caching being used by the Web server.
Protected Properties ClassResourcePath Gets the base path to Web Part class resources.
Protected Properties ContainerWidth Gets the value set by the page author as a hint to the Web Part of how wide to expect the containing Web Part zone to be. Obsolete. 
Protected Properties OverflowAuto Gets a value indicating whether you can override the default setting for the cascading style sheet (CSS) overflow attribute when rendering the Web Part.
Protected Properties SaveProperties Gets or sets whether a Web Part's properties have changed and should be persisted at the end of page rendering.
Protected Properties SerializeAll Gets whether a retrieved property value should be serialized for use in the client-side WPSC property collection.
Protected Properties ServerRelativeClassResourcePath Gets the server-relative path to Web Part class resources.
Protected Properties ShouldValidate Gets a value indicating whether the Web Part infrastructure should perform data validation of Web Part properties before setting them.
Protected Properties WebPartMenu Gets or sets the Web Part menu source that is rendered in the frame of the Web Part.
Protected Properties WorkItemTimeout Obsolete. 
Public Methods
Public Methods ShouldSerializeAllowConnect Returns whether the AllowConnect property has changed from its default value.
Public Methods ShouldSerializeAllowEdit Returns whether the AllowEdit property has changed from its default value.
Public Methods ShouldSerializeAllowHide Returns whether the AllowHide property has changed from its default value.
Public Methods ShouldSerializeHelpMode Returns whether the HelpMode property has changed from its default value.
Public Methods ShouldSerializeID Returns whether the ID property has changed from its default value.
Protected Methods
Protected  Methods RequiresWebPartClientScript  

posted on Saturday, May 20, 2006 10:07 AM

Feedback

# re: What's new in the WSS v3 Microsoft.SharePoint.WebPartPages.WebPart class? 5/22/2006 8:39 AM Sahil Malik
Excellent post Andrew

# Sharepoint 2007 WebPart Connections - The Theory before the Code. 5/22/2006 1:36 PM Sahil Malik - blah.winsmarts.com
If you've been following my blog, Quote from - Writing Custom Webparts for Sharepoint 2007 "... It is highly recommended that you should write an ASP.NET 2.0 WebPart instead of one that inherits from the Sharepoint WebPart .... it appropriate to build Web Parts ...

 re: What's new in the WSS v3 Microsoft.SharePoint.WebPartPages.WebPart class? 11/13/2006 12:35 AM Thien Le
Gravatar Hi All.

I can not use PartCacheWrite with Storage.Personal mode in WSS V3. Do you know other method or some configuration to solve this problem. Thanks alot.

Best regards.
Thien Le


 re: What's new in the WSS v3 Microsoft.SharePoint.WebPartPages.WebPart class? 6/22/2007 10:33 AM Driche
Gravatar Hi,

I would like to know also what is the method to use instead of PartCacheWrite.

Regards

Driche

 re: What's new in the WSS v3 Microsoft.SharePoint.WebPartPages.WebPart class? 6/22/2007 11:24 AM Driche
Gravatar I'Have the answer,
unfortunately there is no other method to use.
You have to use ASP.NET 2.0 caching !



 re: What's new in the WSS v3 Microsoft.SharePoint.WebPartPages.WebPart class? 6/17/2008 3:06 AM Saurabh
Gravatar hi,

I would like to know.......how can we create a StaticConnection in SharePoint Webparts....???

Post Feedback

Title:
Name:
Email:
(email will not be displayed)
Url:
Comments: 
Please add 1 and 1 and type the answer here:    
All Comments Are Filtered & Moderated
Unfortunately comment spammers are just too effecient and are constantly dirtying up blogs with irrelevant and unwanted comments trying to improve their standing on search engines. All comments on this blog are moderated. I do not censor comments, but I don't approve comments with vulger language or those soliciting products. Most of the time comments are approved within a few hours of being submitted with the only exception when I'm traveling.

Why are you asking for my email address?
The only reason I'm asking for your email address, which isn't required to submit a comment, is to provide a gravatar if you've created an account for yourself and associated your email address with a small image. If you have a gravatar created for the email address you submit, it will appear next to your comment. Otherwise nothing will appear.

What is a gravatar?
A gravatar is a "globally recognized avatar." You can get more information about gravatars, as well as create your own for free, at www.gravatar.com. You can also view my gravatar here.


Copyright © 2003 - 2009 Andrew Connell
Creative Commons License 
This work is licensed under a Creative Commons License
Site design by Heather Solomon.

 
 
MOSS WCM Training
Looking for MOSS 2007 WCM developer training? Look no further! I teach my 4-day hands-on and 5-day online WCM classes for developers I offer through the Ted Pattison Group.

Get more information on the WCM courses!


Upcoming Classes
 Hands-on WCM:
 » Las Vegas, NV
   April 20-24, 2009
 Online WCM:
 » Feb 9-13, 2009


» Register today!

JAX Office Geeks
Jacksonville Office Geeks (JOG)
JOG is a special interest group in Jacksonville, FL dedicated to bringing the local SharePoint commnity together to share tips, tricks, ideas and best practices for developing solutions on the SharePoint platform.

Next meeting details...
When:
Thur. Feb 19th, 2008
  6-8p EDT
Topic:
Cheap and Easy Wildcard Search

Speaker:
Becky Isserman

RSVP Today!


» Subscribe to the JOG newsletter