Reputation: 8302
Lets say you have a simple Web Form with an ASP.NET Label control. When and how does the Label control get turned into a span element for the browser?
Upvotes: 1
Views: 437
Reputation: 50728
The Page has a Render method, within the page hierarchy (process runs after PreRender page event). This Rendering process navigates through the control hierarchy of the page, and calls the Render method on each control. label has a Render method that renders a label or span accordingly, and the Rendered HTML flushes to the browser.
When you drag a control onto the page in the Visual Studio designer (or other tool), it places that control within a hierarchy that contains all of the page's controls, so the Label would be rendered within the hierarchy. For instance, if you had:
Page
Panel control
Label control
The label will be rendered within the markup of the panel, since the Panel is the parent of the Label.
Upvotes: 6