What does Prerender() do?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mickey0
    New Member
    • Jan 2008
    • 142

    What does Prerender() do?

    Hello,
    I read this

    and I was wondering if there's anyone that can explain to me what Prerender should do, for example for a button or a calendar component.
    I can't imagine it; can you show me few lines?
    thanks
  • shaahin
    New Member
    • Jul 2010
    • 11

    #2
    Hi
    MSDN :
    Raised after the Page object has created all controls that are required in order to render the page, including child controls of composite controls. (To do this, the Page object calls EnsureChildCont rols for each control and for the page.)

    The Page object raises the PreRender event on the Page object, and then recursively does the same for each child control. The PreRender event of individual controls occurs after the PreRender event of the page.

    Use the event to make final changes to the contents of the page or its controls before the rendering stage begins.

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      The PreRender event is the last stage in the ASP.NET Life Cycle that you have access to the controls on your page (or within your user control). At point all of the control event code has been executed so you can check the states of all of your controls and do things accordingly.


      I use the PreRender event quite often...it's very useful.

      Please note, though, that the PreRender event for a control/user-control is only called if the control is being rendered. If the control's Visible property is set to False, the event is not called.

      -Frinny

      Comment

      Working...