Which method displays the custom control?
-
The Prerender
-
Render
-
Page_Load
-
Display
The Render method is responsible for generating the HTML output that displays a custom control to the browser. This method is called during the control lifecycle after all processing is complete. Prerender prepares the control, Page_Load handles initialization, and Display is not a standard control method.
In ASP.NET Web Forms, a custom (server) control produces its visible HTML output by overriding the Render method, which writes directly to an HtmlTextWriter to emit markup to the response. PreRender is a lifecycle event that fires just before rendering, used for last-minute state changes, not for producing output. Page_Load handles page initialization logic, not control rendering. Display isn't a standard ASP.NET control method at all. So Render is the correct method that actually displays/outputs the custom control's markup.