Sharepoint 2010 WebPart Tutorial

Webparts as you know are Reusable components that can be deployed and added to many different sharepoint site pages. In this post we will talk about custom and Out-of-box webparts in SharePoint 2010.

In sharePoint 2010 we can create two kind of custom WebParts :

1. Visual WebPart - While creating a Visual webpart you will have a design interface available with you, where you can simply drag and drop checkboxes, labels or your own custom controls to make up the webpart UI. To add the business logic, a code behind file is also attached to the webpart.

Technically, a Visual webpart in SharePoint 2010 is a ascx User Control that is hosted inside a standard webpart. If you notice that the webpart class does not now inherit form a Microsoft.SharePoint.webpartpages.webparts or System.Web.UI.WebControls.WebParts instead it inherits from UserControl namespace.

2. Standard AsP.NET WbeParts - Here you will have to build uo your user interface and logic in a class file. Unlike, visual webpart standad webparts in SharePoint 2010 does not gives you any drag and drop design surface for developing WebPart UI. This type of webpart Inherits from Standard ASP.Net webpart instead of UserControl or SharePoint.webpart.

WebPart Packaging -
Visual Studio 2010 package and deploy webparts when you press Clt + F5. It has a packaging and deployment processor which will create the needed solution package for your webpart and will deploy it in your sharepoint site. You can then add the webparts on any sharepoint site page from webpart gallery.

See WebPart examples at this Video :
SharePoint 2010 webparts

Lets talk about Out-of-Box webparts - In sharePoint 2010 many new Out-of-Box webparts are available for better representation of SharePoint data. You will initially see few categories in the Add Webpart pane but if you go to Site Actions->galleries and WebParts, you can add various other webparts available into your categories.



This is a personal weblog. The opinions expressed here represent my own and not those of my employer or anyone else. Should you have any questions or concerns please e-mail me at .

Copyright (c) 2010 @ All rights are reserved.Do Not Copy.

@ Learning