Introduction
Custom user controls provide custom functionality for your SharePoint Solution. A user control is a control that is associated with a .ASCX extension. It can reuse that functionality within your project and can include the user controls in a master page, web part, or an application page. In this article, I will explain how to create Custom User Control Templates in SharePoint 2013, using Visual Studio.
Pre-Requisites
- Open Visual Studio.
- Open New Project dialog box. Expand Office/SharePoint node and then choose SharePoint Solutions.

- Choose the SharePoint 2013 – Empty Project template. Name the project as CustomControlProject.

- Choose the "Deploy as a farm solution" option (because User Control will work only in farm solutions) and click Finish.

- CustomControlProject SharePoint project gets created.

Create Custom User Control
- Right click on CustomControlProject -> Add -> New Folder.

- Name the folder as “USER CONTROLS”.

- Right click on USER CONTROLS folder ->Add -> New Item.

- Add User Control (Farm Solution Only) from the Add New Item window. Name it as “CustomControl”.

- User control will be created in the following folder structure.

- Open CustomControl.ascx file and add the fields we want, in user control from the Toolbox panel.

- Open CustomControl.ascx.cs file and write the C# code behind function for the event receivers.

- Create Application page or Master page to the CustomControlProject.

- Add the “CustomControl.ascx” user control to the Application page or Master page,
- <%@ Register TagPrefix="UserControl1" TagName="CustomControl" Src="~/_controltemplates/15/CustomControlProject/CustomControl.ascx" %>

- Add the declared user control inside the page content <asp:Content> tag.
- <UserControl1:CustomControl runat="server" id="CustomControlTemplate" />

- Build and deploy the SharePoint solution.
- Open the SharePoint site and open the ApplicationPage1.aspx page.
/_layouts/15/CustomControlProject/ApplicationPage1.aspx - Our User Control gets added to the application page.

Summary - Thus, you have learned how to create Custom User Control Templates in SharePoint 2013, using Visual Studio.

Humayun Kabir MamunPosted Sep 27, 2016, 2:30 AM
Nice...