With the release of Microsoft Visual Studio 2008 many SharePoint Developers will be interested in creating custom Web Parts for SharePoint. This is entirely achievable and not very different from how it is done within Visual Studio 2005.
While the avenues to accomplishing this are similar with Microsoft Visual Studio 2005, there are a few items to consider:
- Visual Studio 2005 Extensions for Windows SharePoint Services is not available or compatible with Microsoft Visual Studio 2008
- As a good practice, it is recommended to backup your project before converting it into Visual Studio 2008
Creating the Web Part Project can be done in two of ways:
- Convert an existing template project from Microsoft Visual Studio 2005
- Create the project from scratch
- Add the following references to the project:
System.Web;
Microsoft.SharePoint
- Add the following code to the top of the project
using System.Web;
using System.Web.UI;
using Microsoft.SharePoint.WebPartPages;
- Assign the class to inherit from the WebPart
public
class
MyCustomWebPart: WebPart- Add the RenderWebPart code:
protected
override
void RenderWebPart(HtmlTextWriter output){
}
- Add desired code inside the "RenderWebPart"
- Determine deployment type: bin or Global Assembly Cache
- By default the Target Framework is 3.5
- Deploy the Custom Web Part
Hi! Pretty post and really impressive thinking,I like the presentation,your style of writing.The informations are really helpful for the newbies like me.Thanks for the fabulous information.Keep up blogging continue.........:)
ReplyDelete