Hosting C ++Write custom WebWidget combination
What is a custom Composite Control?
Custom Web Composite Control, as its name says: one or more server programs and HTML controls are integrated into a single control. A custom Composite Control is similar in functionality to a user control. The biggest difference is that it only exists in its own set of Programs (or shares it with other controls ), it can be placed in a toolbar and provides a WYSIWYG view of the controls it contains.
On the other hand, custom Web control combinations are more difficult to create than user control, because Visual Studio. NET designers do not provide any tools to create them visually. Therefore, the question is: why should I replace user controls with composite controls? When distributing controls to multiple Web programs or systems, it is much better to use custom Web Composite controls, and user controls are best used where reuse is not emphasized, for example, if you are only planning to use controls on your own website, user controls may be a better choice. Basically, you have to make a trade-off between the extra effort you have made to create it and the number of reusable times you have obtained. At the same time, because the custom composite control only exists in its own Assembly, only one copy is required on each computer, and the user control is placed in the Web assembly. Therefore, it must be stored on every Web site that uses it.
Create a custom WebWidget combination
The procedure for creating a custom Web Composite Control is essentially the same as creating a custom superclass Web control. In this example, It is SearchControl. The first thing to do is to design the appearance of the control, after that, it looks like 1.
Figure 1: widget exterior in the designer
SearchControl, as shown above, consists of three server controls (actually there are four, which will be discussed later): a tag control, a text box control, and a button. In addition, the tricky part of custom Web Composite controls is that they do not have a good drag-and-drop design tool to support the creation of controls, but need to be done in the old way-manually writing code. However, it is not completely correct. You do not need to manually write the server or HTML control code here. How can you create the appearance of SearchControl?
First, write the definitions of three server controls in the SearchControl class:
Label * label;
TextBox & n