Building User Controls in ASP.NETUser controls can be built by combining other html server controls, web server controls, and validation controls. This combination depends on the functionality that you are looking for in your web application. Create a file with an extension .ascx or use the Visual Studio .Net IDE to create a user control and it will take care of the extension. In this file you can add all the controls and the functionalities needed for a particular task in your web application. Save the file and now you have to add that user control to the web page in which you are going to use. The .ascx files are not executed as it by the web server instead they have to be used in the aspx files. To add the user control to the web page you have to register it by using the @register directive. In this directive set the TagPrefix and the TagName attributes. These attributes are used while using the user control in the web page. To insert the user control all you have to do is to use the following syntax for the control. <TagPrefix:TagName runat="server" /> Now save the .aspx file and run the web application. Now the user control is rendered with the functionality needed.
|