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>

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

Advertisements
This entry was posted in Asp.Net, Tips. Bookmark the permalink.

One Response to Register Custom User Control in Web.Config File

  1. aparna john says:

    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……..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s