有人可以证实我对asp.net现场循环的理解? [英] can someone confirm my understanding about asp.net live cycle?

查看:158
本文介绍了有人可以证实我对asp.net现场循环的理解?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是找到一种方法,在最后时刻更新页面的标题获得创建之前

my goal is to find a way to update the title of the page at the very last moment before it get created

我有一个母版页和内容占位符,总是插入具有特定属性的页面。

I have a master page and a content place holder that always contain a page with a specific property.

这是属性可在code随时随地更新,但我想该标记的最终值是HTML标题

that property can be updated anywhere in the code but I want the final value of that tag to be the html title

是页面的prerender事件来设置标题的最佳地点?

is the prerender event of that page the best place to set the title?

推荐答案

preRender 终止的有一个的地方,你可以设置标题另一个-later-是 preRenderComplete

PreRender is one place where you could set the title, another -later- is PreRenderComplete:

protected void Page_Init(object sender, EventArgs e)
{
    this.PreRenderComplete += Page_PreRenderComplete;
    this.SaveStateComplete += Page_SaveStateComplete;
}

修改:只注意到你甚至可以用 SaveStateComplete 事件,这应该是在那里你可以改变标题最新的地方:

Edit: Just noticed that you can even use SaveStateComplete event, that should be latest place where you could change the title:

protected void Page_PreRenderComplete(object sender, EventArgs e)
{
    Page.Title = "late title";
}


protected void Page_SaveStateComplete(object sender, EventArgs e)
{
    Page.Title = "very late title";
}

有关网页标题一些额外的信息在masterpages和站点地图数据:

Some additional informations about page-title in masterpages and Site Map Data:

动态设置页面的标题在ASP.NET 2.0

这篇关于有人可以证实我对asp.net现场循环的理解?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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