Create directory of custom webusercontrols

96 Views Asked by At

I am very exited to find out how to do this.

I have created 10 custom webusercontrols which is meant to be used on several custom sites on my website etc. and I want to find out how I can make a directory which will work the same as the asp.net.

At the moment I have to register the webusercontrol at the top of the page like this:

<%@ Register TagPrefix="prefix" TagName="UserControl" Src="Source" %>

How do I create a directory that contains all of my webusercontrols, so I only have to register the assembly and can use the prefix and then the intellisense will appear?

<MyPrefix:'list of my controls' />
1

There are 1 best solutions below

2
On

You can register user controls in the web.config so you don't have to register them on every page

<pages>
<controls>
<add tagPrefix="myprefix" src="~/mycontrol.ascx" tagName="MyControl" />
</controls>
</pages>

I think this will achieve what you're trying to do, you'll get intellisense when you type the prefix