Need more personalized controls, then you will have two options, and the user control user control custom control Custom Control write a custom control is essentially a new Server control. difficulty
In fact, the ordinary web form program can be modified to become a user control, and when a web form program is used as a Server control, this webform program is called the "User Control" user control extension as "ASCX" user The control is required to use the Register directive in other programs to use it. <% @ Register tagprefix = "Error! The hyperlink reference is invalid." Tagname = "error! Super link reference is invalid." SRC = "Pathname"%> TagPRefix determines the unique naming control (Namespace) of the user control, multiple user controls The same tagprefix tagname is the name of this user control. This name can be taken, which is used to distinguish between multiple user controls in the same page. The reference form of the user control is:
When defining the time processing of the user control, you must be aware that the public modifier cannot be used because the event can only occur inside the user control. If you use public modifications, you can use external access, which is obviously not ruled, so you can only use private. Make modification (because the default modifier is private, so the program can be omitted) The other common mistake is to use the HTMLFORM control in the user control. This is also not allowed because HTMLFORM controls often appear in the page of the reference control. If the HTMLFORM control is also included in the user control, the nested use of the HTMLFORM control will appear, which is logically unreasonable, and it is inevitable.
Creating User Controls in the program code In Web Form, user controls can be created not only by:
DIM CL As UserControl = LoadControl ("Pagelet7.ascx") CType (C1, (Pagelet7_ascx)). Category = "Business" Page.Controls.Add (C1)
Varcl: UserControl = loadingControl ("Pagelet7.ascx"); (Pagelet7_ascx (C1)). Category = "Business"; page.controls.add (c1);