Control title in master page with content page code
<%@ page language="C#" MasterPageFile="~/Default.master" %>
<%@ MasterType VirtualPath="~/Default.master" %>
<script runat="server" language="c#">
void Page_Load(object sender, System.EventArgs e) {
this.Master.HtmlTitle = "Hello World!";
}
</script>
File: Default.master
<%@ master language="C#" %>
<script runat="server">
public string HtmlTitle {
get { return this.literal1.Text; }
set { this.literal1.Text = value; }
}
</script>
<html>
<head runat="server">
<title><ASP:Literal id="literal1" runat="server" /></title>
</head>
<body>
<form runat="server">
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server"/>
</form>
</body>
</html>
Related examples in the same category