Reputation: 5519
I'm unable to set the tab title of my ASP.NET pages.
I have nested master pages. I can set tab icon successfully, but the title always show "Home Page". What am I doing wrong?
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Topbar.master.cs" Inherits="WebApplication1.Masters.Topbar" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>SomeTitle</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="~/Styles/public.css" rel="stylesheet" type="text/css" />
<link rel="Shortcut Icon" href="~/Images/ionicon.ico" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
....
<%@ Master Language="C#" MasterPageFile="~/Masters/Topbar.Master" AutoEventWireup="true"
CodeBehind="Public.Master.cs" Inherits="WebApplication1.PublicMaster" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</asp:Content>
Upvotes: 1
Views: 5046
Reputation: 142
You can also do it from server side by keeping this block in master page code file
string pageNM = Request.Url.ToString();
if (pageNM.Contains("index.aspx"))
{
this.Page.Title = "My custom Index Page Title";
}
Upvotes: 1
Reputation: 3271
On the content page you should be using a @Page directive, in which you can set the page title:
<%@ Page Language="C#" MasterPageFile="~/Master1.master"
AutoEventWireup="true" Title="Untitled Page" %>
Upvotes: 8