简体   繁体   English

在ASP.net页面生命周期中,可以访问哪个状态的控件?

[英]In ASP.net Page life cycle on which state Controls is accessible?

In an ASP.net page life cycle, on which state are controls accessible? 在ASP.net页面生命周期中,控件可以访问哪个状态? According to me it is after Initialize, is that correct? 据我说是在初始化之后,对吗?

It depends on what you mean by accessible. 这取决于您可访问性的含义。 You will usually want to access the controls sometime between OnInit and OnLoad. 您通常需要在OnInit和OnLoad之间的某个时间访问控件。

Here's a great guide that explains the page lifecylce, and when to use each event: 这是一本很好的指南,解释了页面生命周期以及何时使用每个事件:

http://www.altafkhatri.com/Technical/ASP_NET_Page_Life_Cycle_And_Events/Common_ASP_NET/Page_Events http://www.altafkhatri.com/Technical/ASP_NET_Page_Life_Cycle_And_Events/Common_ASP_NET/Page_Events

I think you are correct. 我认为你是对的。

This is from MSDN: 这是从MSDN:

Init - Raised after all controls have been initialized and any skin settings have been applied. 初始化-在初始化所有控件并应用任何外观设置之后引发。 The Init event of individual controls occurs before the Init event of the page. 各个控件的Init事件发生在页面的Init事件之前。 Use this event to read or initialize control properties. 使用此事件读取或初始化控件属性。

You may check this link for more details: ASP.NET Page Life Cycle Overview 您可以检查此链接以获取更多详细信息: ASP.NET页面生命周期概述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM