SharePoint WebPart or ASP.NET WebPart?


Table of Contents

When creating a WebPart you first have to choose which type of WebPart implementation to use. You have two options:

The main differences are that the SharePoint WebPart is a heritage from SharePoint 2003/WSS 2.0 and can still be used in current version of SharePoint (MOSS 2007/WSS 3.0). The ASP.NET 2.0 WebPart is newer and comes from the standard ASP.NET 2.0 class library. The ASP.NET version can also be used in applications built solely on ASP.NET, ie it does not require SharePoint.

One drawback of using the ASP.NET 2.0 WebPart is that it has limitations in the WebPart connections; it can only connect WebParts, living in WebPartZones (can be different zones), on the same page.

Another big difference is how the WebPart properties are handled, each implementation has different attributes that are required on the properties to make them available for editing.

As a best practice it is recommended to use the ASP.NET 2.0 as this is most likely the future of WebParts, for upcoming versions of SharePoint. (As of today the ASP.NET 4.0 preview from PDC08 has no changes in the WebPart classes compared to ASP.NET 2.0)

Note: most samples on MSDN uses the SharePoint WebPart class.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.



Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. Hosted generously by CustomWare