Web Control development essay (3): A Preliminary Study on the Rendering Method of Control and WebControl

Source: Internet
Author: User
Tags opening and closing tags

Control
:

Render
:
WebControl inherited from
Control class, And overwrites
Render
Method. This method should be overwritten by subclass.

RenderChildren: child node used to present the control
(Usually
HTML)

RenderControl
: Used to render controls
(
Is
Control
Object
)

RenderChildren is the rendering control, while
CreateChildControls is mainly used to initialize the child control (note that it is not used to render the child control ).

 

WebControl:
(
Inheritance
Control
Methods
)

About
Render
Several important methods
(
The method parameters are
HtmlTextWriter (related
Three enumeration types:
HtmlTextWriterTag
,
HtmlTextWriterAttribute
,
HtmlTextWriterStyle
))
:

AddAttributesToRender:
The subclass of WebControl should override this method to include the outermost layer for rendering.
HTML Element
Code for HTML attributes
Block.

RenderBeginTag:
The subclass of WebControl should override this method to include the outermost layer for rendering.
Code for opening the HTML Element
Block.

RenderContents:
The subclass of WebControl should override this method to include the outermost layer for rendering.
Nested between opening and closing tags of HTML elements
HTML code block.

RenderEndTag:
The subclass of WebControl should override this method to include the outermost layer for rendering.
Code for disabling HTML elements
Block.

TagKey attribute: Read-only attribute, used to set the outermost layer
HTML Element
HTML element.

Event Call Sequence

  1. CreateChildControls
  2. OnInit
  3. TrackViewState
  4. LoadViewState
  5. LoadPostData
  6. OnLoad
  7. RaisePostDataChangedEvent
  8. OnBubbleEvent)
  9. OnPreRender
  10. SaveViewState
  11. RenderControl
  12. Render
    1. RenderBeginTag
    2. AddAttributesToRender
    3. CreateControlStyle
    4. RenderContents
    5. RenderChildren
    6. RenderEndTag
  13. OnUnload

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.