Udostępnij za pośrednictwem


How to: Create a SharePoint Web Part by Using a Designer

A Visual Web Part combines a Web Part item with a User Control item. You can design the appearance of the Web Part by dragging controls from the Visual Studio Toolbox to the surface of the user control.

To create a Visual Web Part, add a Visual Web Part item to any SharePoint project.

Note

The project must be in a solution that is configured to deploy as a farm solution.

To create a Visual Web Part project

  1. On the File menu, point to New, and then click Project. If your IDE is set to use Visual Basic development settings, on the File menu, click New Project.

    The New Project dialog box appears.

  2. Open the New Project dialog box, expand the SharePoint node under the language that you want to use, and then select the 2010 node.

  3. In the Templates pane, select Visual Web Part, and then click OK.

    The SharePoint Customization Wizard appears.

  4. In the What local site do you want to use for debugging page, type the URL of the SharePoint Web site that you will use to test the Web Part, and then click Finish. This site must be on the local computer.

  5. A Web Part item and a User Control item appear in Solution Explorer.

To add a Visual Web Part to an existing SharePoint project

  1. On the Project menu, click Add New Item.

  2. In the Add New Item dialog box, select Visual Web Part.

  3. In the Name box, type a name for the Web Part, and then click Add.

  4. A Web Part item and a User Control item appear in Solution Explorer.

See Also

Tasks

How to: Create a SharePoint Web Part

Walkthrough: Creating a Web Part for SharePoint

Walkthrough: Creating a Web Part for SharePoint by Using a Designer

Other Resources

Creating Web Parts for SharePoint