开发者

No LoadComplete for a MasterPage?

With AutoEventWireUp set to false, I would normally set a Page_Finalize like this:

Include(Self.LoadComplete, Self.Page_Finalize); //Delphi

LoadComplete however, doesn't seem to be available on a MasterPage and my Page_Finalize obviously doesn't get called.

What a开发者_开发技巧m I meant to do to free objects in the master page?

Thanks.


LoadComplete method is simply not a member of MasterPage, but of Page.

There are several reasons for this, including the fact that the orchestrator of page life cycle is Page class itself.

It has three event-related methods: PreLoad, Load, LoadComplete. During Load, the Load event of children controls is triggered.

While a master page contains (by means of layout) the contents of the page, the page contains the MasterPage by means of objects, since the Page is the IHttpHandler that responds to HTTP requests in ASP.NET.

Briefly, you cannot override (I don't know Delphi, is that some kind of override?) OnLoadComplete in MasterPage as it's not defined. Only OnLoad


A bit late, but adding a method to the Page.LoadComplete event from the master page seems to work.

Within the master page:

protected void Page_Load(object sender, EventArgs e) {
    Page.LoadComplete += Page_LoadComplete;
}

protected void Page_LoadComplete(object sender, EventArgs e) {
    // do stuff on LoadComplete in the master page
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜