How to restore a form with a custom control of ASP. NET Server

Source: Internet
Author: User

Using custom controls of ASP. NET servers to restore forms is a common application in enterprises. In this process, many technical points of ASP. NET Server custom controls are involved. Each custom ASP. NET Server Control is universal. Now we will use an example of using the custom control of ASP. NET Server to restore forms in XML files. We will briefly introduce the technical points of the custom control of ASP. NET Server. The Source Code cannot be provided due to some confidential issues.

Use the custom control of the ASP. NET Server to read various controls of the form information form from the XML file) to dynamically generate various controls, involving several technical points:

1. Read XML files

2. Composite controls

3. control array

4. Programming controls various attributes of the ASP. NET Server custom control.

5. HTML Rendering Method

ASP. NET Server Control is a set of logic that provides a browser-independent user interface component that contains methods and attributes. When a page is submitted, it triggers events on the server, ASP. the custom control of the. NET Server detects the type of the customer device and then presents itself in the supported markup language. It supports HTML, XML, and DHTML.

◆ Read XML, so I won't talk about it anymore.

◆ Lifecycle of custom controls on ASP. NET Server:

◆ Composite ASP. NET Server controls: use a combination of classes to use two or more controls in the parent Control) to create composite controls. The control used in this new control is a child control at this time, but the generated control contains the functions of all child controls. The new control presents a user interface, which can reuse the functions of existing controls, including these ASP.. NET Server Control Properties and events. The parent control can process events triggered by child controls. You need to consider two things when creating a composite control. To add a control to an ASP. NET Server Control set, you must override the protected CreateChildControls () method, which is inherited from the control. In this method, use the Controls. Add () method to Add each sub-control to the Control tree.

To avoid naming conflicts between child controls and other controls on the page, you must use the INamingContainer interface. If the control has any type of data binding, it is a template control, or it needs to send events to the Child control, you need to use this interface. Note: The subcontrol processes all rendering for the control, so you do not need to override the Render () method ).

◆ Control array: because a large number of controls of the same type exist in the restore form, the most direct data structure is the array,. net framework does not support control arrays. By searching for data, you can find a method to simulate the control array: Use the CollectionBase class, which provides an abstract base class for a strongly typed collection. we can use it to implement our control array. The control array can contain any number of controls.

◆ Display ASP. NET Server Control: Restores a form that contains lines and other form elements without corresponding server standard controls. You must control ASP by programming. the key class used here is HtmlTextWritter: not only can HTML content and text be written, but when HTML content is presented to the request client, it also provides formatting capabilities, including tag management and adding styles for HTML content.

  1. ASP. NET Server Control Development-Composite Control
  2. Basic concepts of ASP. NET 2.0 Server Control Development
  3. Analysis on the lifecycle of ASP. NET Server controls
  4. ASP. NET Server-side control CheckBoxList
  5. Optimal Selection of ASP. NET Server controls

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.