Duration: 17 minutes
Summary: In this video, we are going to discuss a different way of adding user controls to be used by the pages, and how we can add a property to the control that we can modify when adding the control to the page. First, we start with adding the user control. So far we have seen that when we need to use a control on a page, we add a Register directive on the top of the page with TagPrefix, TagName, and Src. But this gets tiring when we need to add the control to multiple pages. To simplify this step, web.config comes to the rescue. We create a new element in <controls> within the <pages> of <system.web>. In that element we provide the usual properties (TagPrefix, TagName, and Src). By doing so we have the control available to all pages in the web site. The second item we need to discuss is adding a property to a control. We can simply do that by adding a public property to the code behind. We can give a default value to it, and the user can change that property when adding the control to the page..
Methodology of the development of example: Good coding standard and simplified design to illustrate the key points.
Technology Used: ASP.NET and Visual Studio 2010Keyword: ASP.NET 4, Visual Studio 2010, Control, Register, TagPrefix, TagName, Src, web.config.