我已经使用主页创建了一个内容页面。如何在内容页面设置标题asp.net
在母版页中,我创建了以下标签标题:
<head id="Head1" runat="server">
<title></title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
</head>
中的内容页面,如下设置:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (String.IsNullOrEmpty(Request.QueryString["PatientRegistrationKey"]))
{
// ....
}
else
{
this.Page.Title = "My New Title";
//....
}
}
虽然我也是在运行时将主页作为波纹管:
protected void Page_PreInit(Object sender, EventArgs e)
{
if (String.IsNullOrEmpty(Request.QueryString["PatientRegistrationKey"]))
this.MasterPageFile = "~/MasterPages/A.master";
else
this.MasterPageFile = "~/MasterPages/B.master";
}
在浏览器中打开此页面时,我得到以下标题:
http://localhost:3562/?PatientRegistrationKey=0
- 我的新标题
的变化请指点,使应该只有我的新标题标题内,没有任何额外的像查询字符串等
任何帮助,将不胜感激。
你要为标题在第一if条件...? – deostroll 2014-05-12 08:38:59