为什么母版页不具有ASP.NET preINIT事件? [英] Why master page doesn't have PreInit event in ASP.NET?

查看:118
本文介绍了为什么母版页不具有ASP.NET preINIT事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是当一个母版页与内容页合并中发生的事件的顺序:

 内容页preINIT事件。
Master页面控件Init事件。
内容控件Init事件。
母版页Init事件。
内容页Init事件。
内容页Load事件。
母版页Load事件。
Master页面控件Load事件。
内容页控件Load事件。
内容页preRender事件。
Master页面preRender事件。
母版页控制preRender事件。
内容分页控件preRender事件。
Master页面控件Unload事件。
内容页控件Unload事件。
母版页Unload事件。
内容页Unload事件。

但为什么母版页不具有 ASP.NET中的 preINIT 事件


解决方案

  

母版不具备preINIT方法。


  
  

有可以采取多种替代方案。


1,创建一个共同的基类页的所有其它页面继承,设置该类主题的财产;
HTTP://www.odeto$c$c.com/Articles/450.aspx

The following is the sequence in which events occur when a master page is merged with a content page:

Content page PreInit event.
Master page controls Init event.
Content controls Init event.
Master page Init event.
Content page Init event.
Content page Load event.
Master page Load event.
Master page controls Load event.
Content page controls Load event.
Content page PreRender event.
Master page PreRender event.
Master page controls PreRender event.
Content page controls PreRender event.
Master page controls Unload event.
Content page controls Unload event.
Master page Unload event.
Content page Unload event.

But why master page doesn't have a PreInit event in ASP.NET?

解决方案

Masterpage doesn't have PreInit method.

There are several alternatives you can adopt.

1, Create a common base page class for all other pages to inherit, set the theme property in that class; http://www.odetocode.com/Articles/450.aspx

这篇关于为什么母版页不具有ASP.NET preINIT事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆