aspx Tutorial

.NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services, .NET articles, Sharepoint 2010, visual studio 2010,Aamir Hasan,IT
Advertise Here

Advertize

wwwSW
Posted by Aamir Hasan   on Thursday, March 31, 2011 Total Views:  

 

In this example, you will see that how can we register multiple web user control in Web.Config.  When you are working on multiple web user control and repeating them on different pages in your project.

Let’s start

Here, I will assume that you know how to create a web site/ web application project.

Open you Web Site, right click on your Web Site from Solution Explorer. Create new folder named CustomControl and add three web user controls with named WebUserControl1.ascx, WebUserControl2.ascx and WebUserControl3.ascx.

Your solution explorer will looks like

 

 Most of developer registers then on each page by adding <%@ Register %> directives to the top of pages.


 <%@ Register src="~/CustomControls/WebUserControl1.ascx" tagname="UserControl" tagprefix="UserControl1" %>

<%@ Register src="~/CustomControls/WebUserControl2.ascx" tagname="UserControl" tagprefix="UserControl2" %>

<%@ Register src="~/CustomControls/WebUserControl3.ascx" tagname="UserControl" tagprefix="UserControl3" %>

 

Let us register web user controls in the Web.Config file.

 

<?xml version="1.0"?>

<configuration>

  <system.web>

    <pages>

      <controls>

        <add tagPrefix="UserControl" src="~/CustomControls/WebUserControl1.ascx" tagName="UserControl1" />

        <add tagPrefix="UserControl" src="~/CustomControls/WebUserControl2.ascx" tagName="UserControl2" />

        <add tagPrefix="UserControl" src="~/CustomControls/WebUserControl3.ascx" tagName="UserControl3" />

      </controls>

    </pages>

  </system.web>

</configuration>

 

Now, Controls can be used in any page


            <UserControl:UserControl1 ID="UserControl1" runat="server" />

            <UserControl:UserControl2 ID="UserControl2" runat="server" />


If the intelligence is enabled in your visual studio, you will see


 

It is easy to use and manage, you don’t have to registered it on multiple page where you have to used web user control.

 

Note: If you have alternative solution, please comments here to share with us.


Output

Download

Register-WebUserControl-in-Web.Config.rar (129.14 kb)

Protected by Copyscape Online Plagiarism Tool

Comments (10) -

offshore company formation
offshore company formation United States
7/29/2011 5:53:47 AM #

This is a really good read for me, Must admit that you are one of the best bloggers I ever saw.Thanks for posting this informative article.

cheap ugg boots
cheap ugg boots People's Republic of China
10/10/2011 12:49:29 AM #

I want the future to be better than the past. I don't want it contaminated by the mistakes and errors with which history is filled. http://www.cheapuggboots2.org/.Find true love and be a true lover as well.May you find a love which is not only strong as death, but to leave to a truly for feeling life.http://www.belstaffjacketzone.com

how can i load that usercontrol from codebehind
how can i load that usercontrol from codebehind United States
11/15/2011 8:57:26 PM #

how can i load that usercontrol from codebehind. I've register the usercontrol in web.config. I will load from codebehind file and add it to the placeholder.

how can i load that usercontrol from codebehind
how can i load that usercontrol from codebehind United States
11/15/2011 8:57:34 PM #

how can i load that usercontrol from codebehind. I've register the usercontrol in web.config. I will load from codebehind file and add it to the placeholder.

james
james United States
11/15/2011 8:58:11 PM #

how can i load that usercontrol from codebehind. I've register the usercontrol in web.config. I will load from codebehind file and add it to the placeholder.

barbour ashby
barbour ashby People's Republic of China
12/2/2011 4:32:48 PM #

There are many brands of barbour Shoreman Jacket in the market today. Each of the brand promises to bring out something new to the customers. barbour fusilier is also a renowned and reputed brand in the market. This brand is in fact reputed for the jackets barbour . You can purchase a Barbour enduro leather jacket and you would be amazed to find yourself. There are different varieties in the barbour jacket that you would get in the market.We will try to provide you few varieties of the barbour scott bracken jacket that are available in the market. The barbour jackets is basically a classically designed and styled Barbour combat coat. http://www.uk-barbourjacket.com/

Air Max 2011
Air Max 2011 United States
12/4/2011 10:57:33 PM #

555ce1
http://www.airmax2011ok.com/

Cheap Timberland Boots
Cheap Timberland Boots United States
12/5/2011 2:10:56 AM #

555ce23
http://www.timberlandonlineboots.com/

Cheap Nike Shox
Cheap Nike Shox United States
12/5/2011 2:45:45 AM #

555ce28
http://www.discountnikeshoxonline.com/

barbour ashby
barbour ashby People's Republic of China
12/6/2011 4:18:34 PM #

There are many brands of barbour Shoreman Jacket in the market today. Each of the brand promises to bring out something new to the customers. barbour fusilier is also a renowned and reputed brand in the market. This brand is in fact reputed for the jackets barbour . You can purchase a Barbour enduro leather jacket and you would be amazed to find yourself. There are different varieties in the barbour jacket that you would get in the market.We will try to provide you few varieties of the barbour scott bracken jacket that are available in the market. The barbour jackets is basically a classically designed and styled Barbour combat coat. http://www.uk-barbourjacket.com/

jeremy scott wings
jeremy scott wings United States
12/23/2011 8:25:44 PM #

<a href="http://www.scottjswings.com/">adidas wings</a>,, For the sport sneaker world, wing shoes was a legend for most people. Achieved success not rely on the flaunt out appearance design or the flooded advertisement, js wings 2.0 gained great fame due to the uncompetitive comfort experience to the excellent functional performance. Ask anyone who having buy js wings 2.0, people always spoke highly to them. I have met a very meat customer in the store, she have many problem of every pair of shoes. Appearently, the weir appearance of this scott wings also get no good recommend by that lady. However, maybe just curious, she have trial wear on the shoes, strange thing happened, that meat lady purchased jeremy scott wings shoes at once. <a href="www.scottjswings.com/...ings-c-1.html">men jeremy scott wings</a>,<a href="www.scottjswings.com/...ng-c-2.html">women jeremy scott wings</a>

replica tiffany jewelry
replica tiffany jewelry Malta
1/10/2012 10:15:22 PM #

www.discounttiffanyoutlet.com/tiffany-bangles/ Tiffany bangle, are pure words perfect the internal organs, unexpected details and perfect style elegant gathered in www.discounttiffanyoutlet.com/tiffany-rings/ tiffany rings. Classical and quality pendant, more and more people choose http://www.discounttiffanyoutlet.com/ replica tiffany jewelry, www.discounttiffanyoutlet.com/tiffany-necklaces/ tiffany necklaces with high uality materials, high technology and unique design. a woman is like a tiffany pendant attractive design.

deee
deee India
1/27/2012 8:51:55 AM #

ccccccccccccccccccccccccccccccccccccccccccccc

sale supra shoes
sale supra shoes People's Republic of China
2/5/2012 4:31:30 PM #

I needed to send you this little note so as to thank you very much over again considering the incredible advice you've featured on this page. It is wonderfully open-handed with people like you to present publicly what a number of people would have offered for an electronic book in making some profit for their own end, principally given that you could have done it in the event you decided. The thoughts additionally served as a easy way to realize that other people online have a similar fervor similar to my very own to learn whole lot more when it comes to this problem. I'm sure there are a lot more enjoyable times ahead for individuals that read carefully your blog.

fddf
fddf People's Republic of China
3/31/2012 9:38:45 PM #

http://www.guccioutletusastore.com

fafafa
fafafa Slovenia
4/23/2012 2:41:36 AM #

http://www.christianlouboutinukk.org   christian louboutin
http://www.tiffanyuks.org   tiffany uk
http://www.gucciukbeltuk.org   gucci belt
http://www.frsaclouisvuittonsac.com   louis vuitton sac
http://www.chanelukoutletuks.org   chanel outlet
http://www.burberryukoutletuk.org   burberry
http://www.poloralphlaurenuko.org   ralph lauren uk

Pingbacks and trackbacks (2)+

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5