在母版页代码中获取页面标题 [英] Get Page Title In Master Page Code Behind
本文介绍了在母版页代码中获取页面标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在c#母版页代码中获取页面标题.
I want to get the page title in c# master page code behind.
我尝试使用Page.Header.Title;
属性,但它返回null
.
I tried using Page.Header.Title;
property but it return null
.
请帮助我获得标题.
谢谢.
Shibin V.M
Shibin V.M
推荐答案
在页面标题中包含runat="server"
,即可轻松获得页面标题,方式是
In your page head include runat="server"
then you can easily get the Page title by
string Title = Page.Title;
使用Page的Title属性需要页面上的标题控件. (例如<head runat="server" />
).
Using the Title property of Page requires a header control on the page. (e.g. <head runat="server" />
).
这篇关于在母版页代码中获取页面标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文