Create and use User Control in Asp.Net

SharePoint deveopment training course

In this post we will discuss how to create and use user control in Asp.Net. Also we will discuss how we can create a website in Also you can check out my previous posts on:

– Tutorial on MVVM with WPF

– C#.Net basic interview questions and answers

– ABC of WCF


Here we will discuss how to create a web site. To create a web site Open Visual Studio 2010 Go to File -> New WebSite.

Then from the New Web Site template dialog box Choose Asp.Net WebSite. Then Give the path and click on OK.

Now since our web site is ready, we will now see how to create a user control. To create a user control Right click on the project then Click on Add New Item. Then from the Add New Item dialog box

Choose Web User Control, give a Name and click on Add. Then in the acsx page you can add the controls that you want. You can see the details on the attached project which you can download from the below.

Now since we have finished creating the user control, we will discuss how to add this to the page.

To add a user control to a page, we have to use the Register tag of We have to write like below:
<%@ Register src=”WebUserControl.ascx” tagname=”WebUserControl” tagprefix=”uc1″ %>
where src is the path of the user control and tagname and tagprefix are used to call the web user control.

Now to call the user control write like below:
<TagPrefix:TagName ID:”ID” runat=”server”/>. So it will be like below:
<uc1:WebUserControl ID=”WebUserControl1″ runat=”server” />

There is also another approach to call or use user conrol. What we need to do is simply drag and drop the user control to the design of the page.

Check out Best Alternative to InfoPath -> Try Now

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)


About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site

View all posts by Bijay Kumar →