ASP.Net Server Management Procedure

What are the ASP.Net server events and how do they relate to the containing page events?

The specific problem is that I am looking for an event inside the server control that fires before the Page_Load event on the contained page.

+3
source share
5 answers

As for how they relate to page events, at least for Init and Load:

"Although both Init and Load occur recursively on each control, they occur in the opposite order. The Init event (as well as the Unload event) for each child control occurs before the corresponding event is raised for its container (from bottom to top). However The Load event for the container occurs before loading events for its child controls (from top to bottom). "

From http://msdn.microsoft.com/en-us/library/ms178472.aspx

+5
source

This should help: http://msdn.microsoft.com/en-us/library/ms178472.aspx

You are looking for PreLoad, I think.

+1
source

. , , . , PreLoad.

+1

This is a small problem because the control can be placed inside the page after the "Page_Load" event.

In one of my historical projects, I deduced all the pages from my class "PageEx: System.Web.UI.Page". Which had the property "CurrentState" of the type "enum PageStates {PreInit, Init, PostInit, PreLoad, / * etc .... * /}". Than all my controls were able to recognize the state of the page loop.

0
source

There's a longer list in ASP.NET 2.0 Event Ordering (note that this is for 2.0).

0
source

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


All Articles