When are controls initialized to their design time?


a) Do I correctly believe that only after the controls on the main page are combined into a control tree for the page can the controls (both on the main page and on the content page) be initialized with their declarative values ​​(values, installed during development)?


b) If my above assumption is correct, then these controls cannot be initialized with their development time values ​​during Page.PreInit, because at the stage of the Page.PreInit events it was still possible to dynamically set the main page ?! So, if so, when are the controls initialized with their declarative values? During an Init event or ...?

thank

+3
source share
1 answer

Pages are compiled into .Net classes, so markup parsing actually occurs outside the page life cycle. When the request reaches your page, the page class was compiled from a combination of markup and code.

This is easy to verify by simply placing a handler Page_PreInitand looking at the properties of the control on the page. You will see that they are installed.

The MasterPage / Page relationship is just a function of how the HTML will be displayed, and containers with the names that everyone lives in.

When the actual compilation of the page occurs, partly depends on how you set up your project and partly perform the function of monitoring ASP.Net files in the application.

+2

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


All Articles