Chapter 8. Creating Web Parts

Web parts are based on ASP.NET web controls, but are otherwise fairly new. For that reason, the development tools for web parts are scattered across a number of different downloads. That makes developing web parts more confusing than it really should be. I try to address this problem by breaking my discussion of web parts into two chapters:

  • This chapter covers setting up your development environment to make writing, debugging, and deploying web parts as easy as possible.

  • Chapter 9 covers writing code to perform useful tasks in those web parts.

You can develop web parts in Visual Basic .NET or Visual C#. Both chapters show sample code in Visual Basic .NET because that is currently the most popular language. Equivalent Visual C# samples are available at http://usingsharepoint.com/samples/Ch08CS.aspx and Ch09CS.aspx.

Preparing to Develop

Developing a web part requires access to the SharePoint DLL, which runs only on Windows 2003. Therefore, you must be running Windows 2003 to do development. There are a couple ways to do this on your development machine:

  • Upgrade to Windows 2003.

  • Use Remote Desktop to access a server running Windows 2003 and do your development there.

  • Use Microsoft Virtual PC to run Windows 2003 within Windows XP on your desktop.

The main advantages and disadvantages of each approach are summarized in Table 8-1.

Table 8-1. Possible web part development approaches

Approach

Advantage

Disadvantage

Upgrade

Best performance for development.

Get Essential SharePoint 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.