Sunday, May 22, 2011

Register Custom User Control in Web.Config File

 

Normally we register any user control or assemblies in page directive of aspx html source if we want to used in any aspx page like.

 


<%@ Register TagPrefix="MyControl" TagName="HeaderControl" Src="Header.ascx" %>
<%@ Register TagPrefix="MyControl" TagName="footerControl" Src="Footer.ascx" %>
<%@ Register TagPrefix="MyAssembly" Assembly="Myassembly" %>
 
 
IF you have header and footer user control and you want to adding on every page or more than one pages then you don’t need to register on every page just register only one time in web.config file and used it multiple time like this way.


<?xml version="1.0"?>
<configuration>
<system.web>
 
        <pages>
        <controls>
        <add tagPrefix="MyControl" src="~/Header.ascx"
        tagName="HeaderControl"/>
        <add tagPrefix="MyControl" src="~/Footer.ascx"
        tagName="footerControl"/>
        <add tagPrefix="MyAssembly" assembly="MyAssembly"/>
        </controls>
        </pages>
        
</system.web>
</configuration>



1 comment:

  1. Hi,Before I go on lets talk about HTML editors, If you are new to Web Design Cochin then I would highly recommend you start out with an HTML editor that provides step by step process to build your web page.Thanks........

    ReplyDelete

PDF Arabic watermark using MVC and iTextSharp

PDF full page Arabic watermark using MVC and iTextSharp Download :  Source Code Most of the time we have requirement to  gen...