Windows Scripting
  Home arrow Windows Scripting arrow Page 2 - Beginning SharePoint Web Part Development
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

Beginning SharePoint Web Part Development
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 20
    2008-08-20

    Table of Contents:
  • Beginning SharePoint Web Part Development
  • Developing your first WSS 3.0 web part using Visual Studio 2008 extensions
  • A better web part with event handling: code
  • A better web part with event handling: explanation
  • Debugging a WSS 3.0 web part using Visual Studio 2008

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


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


    (Page 2 of 5 )

    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()

    MyBase.CreateChildControls()


    'TODO: add custom rendering code here.

    Dim label As New Label()

    label.Text = "Hello World"

    Me.Controls.Add(label)

    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.

    More Windows Scripting Articles
    More By Jagadish Chaterjee


       · Hello guys,This is my first article in the series focusing on "sharepoint web...
       · Hello, I liked the article a lot, I followed it along and was able to create a web...
       · I have checked with different articles and thre were some comlexities in the...
       · Hi,with the help of your tutorial i have created and deploy the web part...
       · I know this article is a bit dated, but I've just discovered it and am trying to go...
       · I receive the same message stating: "This solution contains two assemblies with the...
       · Great post, but im not very familiar with VB and I was wondering if there ae samples...
       · Thak you for this article. But I have a request. Could you write a artcile about...
     

    WINDOWS SCRIPTING ARTICLES

    - More Windows Scripting Workarounds from Nilpo
    - Overloading Methods and More in VBScript
    - Improving MFC for Windows Vista
    - Regular Expressions in VBScript
    - Working with Dates in WMI
    - Completing Calendars with VBScript Date Func...
    - Building Calendars with VBScript Date Functi...
    - Working With Dates and Times in VBScript
    - Designing WCF DataContract Classes Using the...
    - Understanding Dates and Times in VBScript
    - Working With Arrays in VBScript
    - Compressed Folders in WSH
    - Using .NET Interops in VBScript
    - Nilpo`s Scripting Secrets, Vol I
    - Database operations using Silverlight 2.0 WC...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek