Vision

Hybrid Web Parts

June 5, 2006

In SharePoint 2007 there are three kinds of web parts:

  • WSS web parts
  • ASP.NET web parts
  • Hybrid web parts

Classic WSS web parts inherit from the Microsoft.SharePoint.WebPartPages.WebPart class. ASP.NET web parts inherit from the System.Web.UI.WebControls.WebParts.WebPart class. Hybrid web parts, just like classic WSS web parts, inherit from Microsoft.SharePoint.WebPartPages.WebPart.

Hybrid web parts use ASP.NET 2.0 web part development techniques and capabilities combined with WSS capabilities. There are a couple of things you can do to automatically make a web part hybrid:

  • The use of the IPersonalizable interface. This interface is new in .NET 2.0 and defines capabilities for the extraction of personalization state.
  • The use of the personalizable attribute which enables a particular property on a web part for personalization.
  • No use of XML serialization attributes.

There are a couple of things you should be aware of when creating hybrid web parts.

  • Hybrid web parts can't return toolparts via the GetToolParts() method. Instead, you will need to use controls that inherit from the EditorPart class (via the CreateEditorPart method).
  • Properties within a hybrid web part that are serializable will not be persisted unless you define a type converter for them.

You can use certain WSS capabilities in a hybrid web part:

  • Web part caching
  • V2 web part connection interfaces
  • Asynchronous features of web parts

At this point, all this information is kinda preliminary, with SharePoint 2007 being in the beta phase and all. We haven't seen documentation about this stuff yet, so if you have anything to add we will be more than happy to update this post (info@lcbridge.nl).

After thoughts...

June 10 2006 - Hybrid web parts - why?

The last couple of days we received a couple of questions asking why you would want to create a hybrid web part. We're not sure how popular creating hybrid web parts will be, but people would want to create hybrid web parts for migration purposes. You could create a web part now in 2003 and combine base WSS capabilities with modern ASP.NET web part development techniques, making a hybrid web part operate like a normal ASP.NET 2.0 web part. Such a web part would be easy to migrate to 2007.

« back to overview page