How to: Create a User Control for a SharePoint Application Page or Web Part
You can create a custom control and include it in a Web Part or Application Page. A user control is a composite control to which you can add other ASP.NET controls and SharePoint controls. You can also define properties and methods for the control. For more information, see Creating Reusable Controls for Web Parts or Application Pages.
To create a user control for SharePoint
Open or create a SharePoint project in Visual Studio. For more information, see SharePoint Project and Project Item Templates.
In Solution Explorer, select the project node.
On the Project menu, click Add New Item.
In the Add New Item dialog box, in the Installed Templates pane, expand the SharePoint node, and then click 2010.
In the list of SharePoint templates, select User Control.
Type a name for the user control in the Name box, and then click Add.
Visual Studio adds a number of folders and files to your project. For more information about these files, see Creating Reusable Controls for Web Parts or Application Pages.
By default, the user control file appears in the Source view of the Visual Web Developer designer. Source view enables you to edit the XML markup of the control.
Switch to Design view if you want to design the control visually by dragging controls from the Toolbox. For more information, see Design View, Web Page Designer.
To handle control events, add code to the code file of the user control.
This file appears in Solution Explorer below the user control file. The code file has a .cs or .vb extension depending on the language of the project.
See Also
Other Resources
Creating Reusable Controls for Web Parts or Application Pages