↑ Grab this Headline Animator

Monday, June 30, 2008

How to Register User Controls and Custom Controls in Web.config?

Instead of importing user controls on a page by adding <%@ Register %> directives to the top of pages in ASP.NET 2.0 instead of duplicating them on all your pages(where ever required), just declare them once within the new pages->controls section with the web.config file of your application. as shown below.
< configuration >

< system.web >

< pages >
< controls >
< add tagPrefix="Head" src="~/Controls/Header.ascx" tagName="header"/>
< add tagPrefix="Footer" src="~/Controls/Footer.ascx" tagName="footer"/>
< /controls>
< /pages>

< /system.web>

< /configuration>

Submit this story to DotNetKicks

No comments:

Post a Comment

Post your comments/questions/feedback for this Article.


Latest Articles