Dear Developer..now you can register User Controls Globally (ASP.NET 2.0)

In ASP.Net 1.x, if you wanted to use any user control, you need to add a page directive (for .ascx) in that .aspx page. Let's say, if you wanted to use in most of the pages, then it's going to be hard as you need to add the directive in most of the pages!


But in ASP.Net 2.0, you can define this at the web.config level. Once you define in web.config, you can use it in entire project.

 

Example syntax in web.config would be as showin below:
<pages>
      
<controls>
            
<add tagPrefix="MenuUCTL" tagName="MenuControl" src="~/MenuControl.ascx" />
      
</controls >
</pages >
</system.web>


Another good thing is, once you add in web.config, you are going to start seeing intelliSense for that control in VS.NET and it’ going to make your life easy in using that control :)

Here is an example picture showing intelliSense for control in VS.NET!



user control intellisense image in vs.net asp.net2.0

 

J Hoping this new feature exites you  J

1 Comment

Comments have been disabled for this content.