Beginning SharePoint Web Part Development – Developing your first WSS 3.0 web part using Visual Studio 2008 extensions

Go through the following steps for creating a new Sharepoint web part using Visual Studio 2008.

  • Open Visual Studio 2008.
  • Go to File || New Project.
  • In the “New Project” dialog, select Visual Basic || Sharepoint, “Web part” template and provide the name “TestSPWebPart.”

  • In the project properties, go to the “Debug” tab and provide http://localhost/testsite.

  • Modify the web part code so that it looks like the following:


Public Class WebPart1

Inherits System.Web.UI.WebControls.WebParts.WebPart


Public Sub New()

End Sub


Protected Overrides Sub CreateChildControls()



‘TODO: add custom rendering code here.

Dim label As New Label()

label.Text = “Hello World”


End Sub


End Class


From the above, you must understand that our custom web parts are being inherited from the “System.Web.UI.WebControls.WebParts.WebPart” namespace. Unfortunately, there is no designer support in Visual Studio 2005/2008 for developing SharePoint web parts. Everything must be coded and developed in the same manner as an ASP.NET custom control.

Deploying and publishing a sample web part in WSS 3.0

Visual Studio 2008 has built-in support to deploy web parts directly to a WSS 3.0 site. This integrated approach saves lots of development time and also helps us to debug web parts very easily. Debugging web parts is covered in the last section of this article.

The following steps continue from where we left off.

  • Using Solution Explorer, right click on project and select “Deploy” as follows.

  • Open the Sharepoint Web Part page as shown below.

  • Change the mode to “Edit” by selecting Site Actions || Edit Page.

  • Click on “Add Web Part” as follows.

  • Select the deployed web part as shown below,

    and click “Add.”

  • Finally, the web part must be shown as in the image below.


You must note that once a web part is deployed, the IIS gets restarted. This happens every time a web part is deployed using Visual Studio 2008.


About eagle081183

Passionate, Loyal
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s