Thursday, December 16, 2010

Register User Controls in Web Config file

Before we start let us first understand User Controls and their advantage.


User controls:- A user control is a kind of composite control that works much like an ASP.NET Web page—you can add existing Web server controls and markup to a user control, and define properties and methods for the control. You can then embed them in ASP.NET Web pages, where they act as a unit. These user controls are reusable and we can add them on as many pages we want.

Now when we use same user control on multiple pages, we always use to register them on every page.we generally do something like this:-













But But But........ We are now in a new world of .net Technologies. So we can now do this in a much cleaner and easier manner in ASP.NET 2.0. Instead of duplicating them on all your pages, just declare them once within the new pages->controls section with the web.config file


















Thanks,
Vikas Sharma

No comments:

Post a Comment