Duration: 16 minutes
Summary: In this video, we start our discussion of user controls. It is natural that ASP.NET allows us to create controls that we can reuse across our pages. It does not make sense that every time we need a group of controls in a page to copy them over from another page. We need the ability to create a control one time and use it in multiple places. A user control serves this purpose. In this case, we create a user control (an ascx control) that contains labels and text boxes to ask the user for first name and last name. Then, we add a button and a label. When the button is clicked, the label displays a welcome message to the user. Once we complete that control, we need to reference it in a page. To do that we need two steps: 1) to add a register directive to the top of the page (with a TagName, TagPrefix, and Src) so ASP.NET knows what control we are using and where it is. 2) Use the control in the page using the TagName and the TagPrefix specified above. In our example, we added the control inside the main content of the page (since this page uses a master 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, User Controls, TextBox, Label, Button, TagPrefix, TagName, Src.