Step 1: Set Up the Project for the Custom Search Web Part
This walkthrough describes how to create the custom Search Web Part using Microsoft Visual Studio 2005. Step 1 describes how to set up the project for the Web Part, and includes the following tasks:
-
Creating the Web Part project
-
Adding the references needed to your project
-
Creating the class file for the Web Part
To create the project for the Web Part
-
In Visual Studio 2005, on the File menu, point to New, and then click Project.
-
In Project types, under C#, select Windows.
-
Under Templates, select Web Control Library.
-
In the Name field, type SearchBDCWebPart, and then click OK.
Next you must add the required references to your Web Part project.
To add references to the SearchBDCWebPart project
-
On the Project menu, click Add Reference.
-
On the .NET tab, select each of the following references, and then click OK after each selection:
-
System.Data
-
System.XML
-
Microsoft.SharePoint
-
Microsoft.Office.Server
-
Microsoft.Office.Server.Search
-
Before you add code for the Web Part, replace the default class file with a new class file.
To create the class file for the Web Part
-
In Solution Explorer, right-click WebCustomControl1.cs, and then click Delete to remove the default class created with the project.
-
On the Project menu, click Add New Item.
-
In the Add New Item dialog box, click Web Custom Control, type SearchProducts.cs, and then click Add.