ASP. NET Custom Controls

Source: Internet
Author: User

ASP. NET custom controls are compiled server-side controls that encapsulate user interfaces and other functions into reusable packages. Compared with standard ASP. NET controls, custom controls have no difference except that they are bound with a different tag prefix and must be explicitly registered and deployed. In addition, custom controls have their own object models that can trigger events and support all design-time features of Microsoft Visual Studio, such as attribute windows, visualizations, property generators, and toolboxes.

A custom control is a class that inherits the base class of a control. You can use either of the following methods to create a custom control. If you find that an existing control only meets some requirements and lacks some key features, you only need to generate a new class from the control class and expand it as needed. If the existing Server Control cannot meet the requirements, consider the following. web. UI. control class or system. web. UI. webcontrols. the webcontrol class inherits from the control class, and some style features are added.

All custom controls are still displayed to users on pages mixed with HTML, CSS, and Javascript. Therefore, when developing custom controls, you must consider whether the existing web page technology can be used, if a feature cannot be implemented in a pure HTML environment, the custom control cannot do the same.

The namespace that is frequently used when developing custom controls is as follows:

    • System. componentmodel -- provides a class for implementing components and controls during runtime and design. It is often used to set the features of custom controls or perform type conversion.
    • System. Web. UI -- contains the basic class of ASP. NET Server controls. The control class is located under the namespace.
    • System. Web. UI. webcontrols -- contains the class for creating ASP. NET Server-side controls on the page. Common buttons, labels, and textbox classes are located under the namespace.
    • System. web. UI. htmlcontrols-also contains a series of server-side controls. web. UI. the difference between webcontrols is that the classes in the namespace are directly mapped to some HTML tags, and these classes are prefixed with htm.

ASP. NET Custom ControlsArticle

Preface

Simple star control on the first day

Star controls with custom styles the next day

On the third day, use the star widget in the control status.

Fold panel custom controls on the fourth day

Star controls that can be scored on the fifth day

Star controls that can be bound to data sources on the sixth day

Develop list controls with rich features on the seventh day

Metric days: displays the data binding controls for multiple entry star rating

The ninth day custom gridview

Datalist that implements the paging function on the tenth day

Download all source code

Download this series of articles in PDF

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.