我很肯定会回过来。 http://msdn.microsoft.com/en-us/library/ms1782.aspx” rel=“nofollow noreferer”>Page Life/a>(即_Page_Init/code>)。
Here s one article by Microsoft on it (for .NET 1.0/1.1):
HOW TO: Dynamically Create Controls in ASP.NET:
Note When you create dynamic controls on a Web Form, you must create the controls and add them to the controls collection in either the Page_Init event handler or the Page_Load event handler. Otherwise, the controls may not behave as expected.
However, in a few posts here, it seems like the above is not the case anymore. Controls added within Page_Load
seems to be working for everyone else. Some of the posts include:
creating dynamic control in asp.net
Viewstate - utter confusion.
我曾尝试过它,实际上,它工作,尽管我没有做过足够的检验,以排除任何意外的行为。
因此,<代码>Page_Load是增加动态控制的安全阶段? 或者,它只是用于2.0和2.0以上的网络?