Friday, May 10, 2013

How to Register Controls in Web.config

In web.config, we can register User controls,custom controls and Third party controls.
just like below


<pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </controls>
    </pages>


Above lines are responsible to register asp.net controls in web.config,so that we are using those controls in all pages across the application without registering them in each individual Page.

if we developed a custom control MyControl

we have to register just like below

<pages>
  <controls>
   <add tagPrefix="Me" namespace="Me.Sample" assembly="Myassembly">
  </controls>
</pages>



No comments:

Post a Comment