SYSK 332: How To Register Custom Controls Once For All Web Pages

Did you know that since .NET 2.0 you can define register directives in the <pages> element in your configuration instead of using @Register directive on every page? It’s especially useful if you’re using a custom control(s) in multiple web pages. Here is an example of registering controls from MyControlLibrary assembly and controls from the web project itself:

 

<pages>

      <controls>

      <add namespace="WebSite1" tagPrefix="lc" />

            <add namespace="MyControls" tagPrefix="cc" assembly="MyControlLibrary"/>

      </controls>

</pages>