Creating a visual web part

In this recipe, we will learn how to create a visual web part. The web part will show data from an external database in a grid format. For our recipe, we will make use of the AdventureWorks database.

Getting ready

For this recipe, you need to have access to the AdventureWorks database. You can download it from: http://msftdbprodsamples.codeplex.com/.

How to do it…

  1. Launch your Visual Studio 2010 IDE as an administrator (right-click on the shortcut and select Run as administrator).
  2. Select File | New | Project. The new project wizard dialog box will be displayed (make sure to select .NET Framework 3.5 in the top drop-down box).
  3. Select Empty SharePoint Project under Visual C# | SharePoint | 2010 node from Installed Templates

Get Microsoft SharePoint 2010 Development with Visual Studio 2010: Expert Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.