with managed C + +writing a custom webGroup Controls
What is a custom grouped control A custom Web Mix control, as its name says, integrates one or more server-side programs and HTML controls in a single control. A custom composite control is functionally similar to a user control. The biggest difference is that it exists only in its own assembly (or shared with other controls), can be placed in a sidebar, and can provide WYSIWYG view of the controls it contains.
On the other hand, custom Web Mix controls are more difficult to create than user controls, because Visual Studio.NET designers do not provide any tools to visualize them, so the question is: Why do you want to replace a user control with a composite control? When you distribute a control to more than one Web program or system, if you use a custom Web Mix control, the situation is much better, and the user control is best used where you don't value reuse, for example, if you're only ready to use controls on your own site, the user control might be a better choice. Basically, between the extra effort you have to create it and the amount of reuse you get from it, make a trade-off; at the same time, because the custom composite control exists only in its own assembly, only one copy is required on each computer, and the user control is placed in the Web assembly, so Must be stored on every web site that uses it.
Create a custom WebGroup Controls The steps to create a custom Web Mix control are essentially the same as creating a custom superclass Web control, in this case, SearchControl, the first thing to do is to design the appearance of the control, which, when finished, looks roughly as shown in Figure 1.
Figure 1: Control appearance in the designer
SearchControl, as seen above, consists of three server-side controls (actually four, which will be mentioned later): A Label control, a text box control, and a button. In addition, the tricky part of customizing a web Mix control is that they don't have a good drag-and-drop design tool to support the creation of controls, but they need to be done by hand-writing code in the old way. But it's not exactly true that you don't have to write the server or HTML control code manually, so how do you create a searchcontrol look?
First, write out the definitions of three server-side controls in the SearchControl class:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.