13

When is inline code executed with relation to page/control lifecycle events such as init and load?

yogibear
  • 14,487
  • 9
  • 32
  • 31
  • 1
    Inline code meaning anything between <% %> and <%= %>, but not <%# %> - data-binding expressions are executed when a control template is data-bound, which can happen at any stage prior to rendering. – Sam Sep 21 '09 at 07:27

1 Answers1

16

Inline code is executed when the page is being rendered ie. after the Page_PreRender event and before the Unload event

Darko
  • 38,310
  • 15
  • 80
  • 107
  • +1 - Just in case anyone wants a reference: http://msdn.microsoft.com/en-us/library/ms178135.aspx embedded code blocks run in the render phase (admittedly taken from another SO answer: http://stackoverflow.com/questions/15209500/in-asp-net-do-inline-expressions-get-executed-before-or-after-the-code-behind) – user420667 Aug 09 '13 at 23:33