Page Preinit, Init, load

I have doubts about the page_ini, page preinit, load. I need to know when we use it also where we need to name our objects at different stages of our life cycle.

Please let me know how they will be handled for each event raised.

+3
source share
3 answers

Page events occur earlier than user events. This launches the PageInit page, and then all users control the PageInit events. PageLoad page events are fired, then all user PageLoad event control elements fire. etc...

Sometimes, developers place the initialization of private objects in their user control for the PageLoad handler.

, PageLoad , . PageLoad , - "", - "throw" ( Object).

PageInit . , "", , .

, - PageInit. , , . , PageInit . PageLoad .

+4

You will probably find that you are using OnInit and Load. The differences mainly relate to the deserialization viewstate event that occurs after OnInit, so you cannot read values ​​from controls in OnInit. In addition, in OnInit you can (necessary) dynamically add new controls to the page.
All other things, such as filling the grid and reading from the form fields (text field, drop-down lists, ...) enter the load event.

+1
source

Source: https://habr.com/ru/post/1698069/


All Articles