Home All Groups Group Topic Archive Search About

asp.net 1.1 page and controls life-cycle

Author
20 Jan 2006 1:33 PM
Fred
hi, i have a page written by someone else w/ a few user controls inside
it(w/ user controls inside em too) - what i dont get is the order
different page_inits, page_loads, cashed and postback events and code
inside <% %> are executing

can u plz point me to a specification or some other description of the
whole process

TIA

Author
20 Jan 2006 2:18 PM
Karl Seguin [MVP]
http://aspalliance.com/articleViewer.aspx?aId=134&pId=

init
load viewstate (if postback)
Process posted data (if postback)
Page Load
Process posted data again (if postback, necessary incase things changed in
page_load)
Raise events (if postback)
Prerender
Save viewstate
Unload

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


Show quote
"Fred" <fred@ilovespam.com> wrote in message
news:uFMBaYcHGHA.2064@TK2MSFTNGP09.phx.gbl...
> hi, i have a page written by someone else w/ a few user controls inside
> it(w/ user controls inside em too) - what i dont get is the order
> different page_inits, page_loads, cashed and postback events and code
> inside <% %> are executing
>
> can u plz point me to a specification or some other description of the
> whole process
>
> TIA
Author
20 Jan 2006 4:59 PM
Fred
tnx for this info, Karl

but what happens when u have controls inside page, when are their events
processed, code inside .aspx pages and <%= %> tag, dynamicly added controls

Karl Seguin [MVP] wrote:
Show quote
> http://aspalliance.com/articleViewer.aspx?aId=134&pId=
>
> init
> load viewstate (if postback)
> Process posted data (if postback)
> Page Load
> Process posted data again (if postback, necessary incase things changed in
> page_load)
> Raise events (if postback)
> Prerender
> Save viewstate
> Unload
>
> Karl
>
Author
20 Jan 2006 5:52 PM
Karl Seguin [MVP]
Events are recursive. If Page_Load fires in the page, then in the child
control, then in controls within the control.

<%= %> happens sometime after prerender

dynamically added controls play catch up when they are added to the page. If
they are added in Init, then init will fire. if they are added during
page_load, then init and page_load will fire...


Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/


Show quote
"Fred" <fred@ilovespam.com> wrote in message
news:uabTeLeHGHA.2896@TK2MSFTNGP09.phx.gbl...
> tnx for this info, Karl
>
> but what happens when u have controls inside page, when are their events
> processed, code inside .aspx pages and <%= %> tag, dynamicly added
> controls
>
> Karl Seguin [MVP] wrote:
>> http://aspalliance.com/articleViewer.aspx?aId=134&pId=
>>
>> init
>> load viewstate (if postback)
>> Process posted data (if postback)
>> Page Load
>> Process posted data again (if postback, necessary incase things changed
>> in page_load)
>> Raise events (if postback)
>> Prerender
>> Save viewstate
>> Unload
>>
>> Karl
>>
Author
20 Jan 2006 8:13 PM
Fred
great, IMHO you should write an article w/ this information

one last detail when are 'script runat=server' blocks in .aspx pages
executed - again after PreRender ?

Karl Seguin [MVP] wrote:
Show quote
> Events are recursive. If Page_Load fires in the page, then in the child
> control, then in controls within the control.
>
> <%= %> happens sometime after prerender
>
> dynamically added controls play catch up when they are added to the page. If
> they are added in Init, then init will fire. if they are added during
> page_load, then init and page_load will fire...
>
>
> Karl
Author
23 Jan 2006 2:19 PM
Karl Seguin [MVP]
Well,  if I recall, you can't just do:

<script runat="server">
Response.Write("aa");
</script>

ur runat="server" needs to have hooks into the actual methods.  so the
<script runat="server"> Page_Load</script> is the same event as the
codebehind one.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


Show quote
"Fred" <fred@ilovespam.com> wrote in message
news:eC0mF4fHGHA.2836@TK2MSFTNGP14.phx.gbl...
> great, IMHO you should write an article w/ this information
>
> one last detail when are 'script runat=server' blocks in .aspx pages
> executed - again after PreRender ?
>
> Karl Seguin [MVP] wrote:
>> Events are recursive. If Page_Load fires in the page, then in the child
>> control, then in controls within the control.
>>
>> <%= %> happens sometime after prerender
>>
>> dynamically added controls play catch up when they are added to the page.
>> If they are added in Init, then init will fire. if they are added during
>> page_load, then init and page_load will fire...
>>
>>
>> Karl

AddThis Social Bookmark Button