Web User Controls - Creation and ImplementationCreating a user control is similar to that of the web page except that the control page has an extension .ascx. If you are creating the user control using the Visual Studio .Net IDE, then these are taken care of automatically. To create a user control, create a file with the extension .ascx and add a @control directive at the top of the page. Give a ClassName attribute to that directive and give a class name. Now add the controls that are needed for your user control and add the functionalities needed to be performed by these controls. Now if needed, you can create properties using public members are using the get and set routines. Having created the user control, now it is time that you use it in a web page. To use a user control in a web page you have to register it first. Use the @register directive to register the user control and add the attributes like TagPrefix, and TagName to it. The syntax for the register directive would be, <%@
Register TagPrefix="some_prefix" TagName="some_name_for_the_ctrl" Now you can use the user control in any part of the web page by using the syntax, <TagPrefix:TagName runat="server" />
|