"ASP. net2.0 secrets" Reading Notes -- two questions you must think about before building custom controls

Source: Internet
Author: User

Before writing custom controls, you need to consider two issues:

1,What type of controls do you want to write?

The two basic types of custom controls are completely generated and combined controls. When building a fully generated control, you must specify all the controls from the beginning to render them toHtmlContent.

Creating a composite control is to bind existing controls to form a new control.

 

2,What classes should I inherit from?

You can derive a new control from an existing control.

When building basic controls, new controls are generally generated from the following base classes.

(1)System. Web. UI. Control

(2)System. Web. UI. webcontrols. webcontrol

(3)System. Web. UI. webcontrols. compositecontrol

 

System. Web. UI. ControlIs the base class of all controls,WebcontrolInherited fromControlClass, whileCompositecontrolClass inherits fromWebcontrolClass.

AllWebControls are from the base classSystem. Web. UI. webcontrols. webcontrolInherited.

ControlClass andWebcontrolThe difference between classes is thatWebcontrolControls derived from a class always have the start tag and end tag, and have more formatting options.

 

 

 

 

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.