After the master page is defined, sometimes we need to change the title of the webpage. However, if we change the title attribute directly on the master page, the same title may occur on other content pages, VS2008 provides new features for the master page.
1. Use the Title attribute in the Page command on the Content Page to change the title of the Content Page:
<% @ Page Language = "C #" MasterPageFile = "~ /MyMaster. master "Title =" My Title "%>
2. Change through programming: The premise is that the Void Page_Load ()
{
......
Page. Header. Title = "My Title ";
......
}
3. Through the head placeholder control of the content page, the master page added in VS2008 will have the following content placeholder asp: ContentPlaceHolder control in the header (drag the title label of the master page to the control)
<Asp: ContentPlaceHolder id = "head" runat = "server">
<Title> No title page </title>
</Asp: ContentPlaceHolder>
On the Content page, a corresponding asp: Content control is often added. You only need to change the title label Content.
<Asp: Content ID = "Content1" ContentPlaceHolderID = "head" Runat = "Server">
<Title> my title </title>
</Asp: Content>