Sunday, April 24, 2011

Registering User Controls and Assembies in Web.config

If you have ever found yourself re-creating the same register tag in ASP.Net Web Forms over and over again, you can easily migrate this content over to the Web.config file and thereby re-use the assemblies or User Controls throughout the Web Site or Web Application.

I recently found myself utilizing the Telerik RadControls for ASP.Net AJAX and therefore had this register directive scattered across several of my ASP.Net Web Forms:

<%@ register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

In order to centralize this code, I migrate it over to Web.config in the following manner:


    <pages>
      <controls>
        <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI"/>
      </controls>
    </pages>



That is all there is to it!

1 comment:

  1. Hi,Find a good balance out of using graphics on your website, because if not then it will look and feel very cluttered in Web Design Cochin. There is also a downside to using too much images on your site and that is it will take more bandwidth to load the whole web pages.Thanks.....

    ReplyDelete