Creating Web parts for SharePoint 2010 using Visual Studio 2010


In this article I demonstrate how to create a simple web part for SharePoint 2010 using
Visual studio 2010.

  1. Open Visual Studio 2010 -> File-> New Project
  2.  
  3. You will get a screen as shown below
     
  4. From the below screen select Visual Web Part from SharePoint category
     
  5. Give proper name for your web part

    image1.gif
     
  6. Click OK
     
  7. Next you have to give the URL of the site where you want to debug or deploy your webpart

    image2.gif
     
  8. Click Finish
     
  9. You will get the below Screen
     
  10. Just click on the Design Mode
     
  11. You will get the Design mode similar to normal ASP.net application
     
  12. You can Drag and Drop any control in to your page I just put a SharePoint Calendar control

    image3.gif
     
  13. You done with the web part .Now we can deploy it and test it
     
  14. Just right Click on the solution and click Deploy

    image4.gif
     
  15. Now go to the site where you deployed.
     
  16. Just open the page in Edit Mode
     
  17. Then click on Add web part
     
  18. Just click on Custom, you can see your web part Add the webpart

    image5.gif
     
  19. You have deployed your web part and tested the same
     
  20. Now next part, how to make it as a Package very easy just right click on the solution
     
  21. It will make a web part package in the folder where we created this web part

    image6.gif
     
  22. It's very simple to work with Visual studio 2010 to develop a web part for SharePoint 2010.