Change TItle of Master Page

Discussion in 'C#' started by ranacseruet, May 5, 2009.

  1. #1
    I am working on a asp website, where its organized by master-page-child page like. I like to change the title of the masterpage related to article on the page. how can this be achieved?
     
    ranacseruet, May 5, 2009 IP
  2. MayurGondaliya

    MayurGondaliya Well-Known Member

    Messages:
    1,233
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    170
    #2
    You can use this.Title property on every child pages to change the titles of that pages.

    this.Title ="My Title";
     
    MayurGondaliya, May 5, 2009 IP
  3. ranacseruet

    ranacseruet Peon

    Messages:
    302
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    this is C# syntax. but i am using VB. Which will be VB syntax?

    Thanks
     
    ranacseruet, May 5, 2009 IP
  4. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Two ways you can do it..
    1. Within the page_load event of the child page. place the code:
    Me.Title = "This is the title"
    Code (markup):
    2. Can be declared at the top of the child page:
    <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="childpage.aspx.vb" Inherits="childpage" Title="This is the title" %>
     
    camjohnson95, May 5, 2009 IP
  5. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #5
    If no title is specified within the child page, the master page's title will be used.
     
    camjohnson95, May 5, 2009 IP
  6. ranacseruet

    ranacseruet Peon

    Messages:
    302
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    hi, gotta problem. which i am working on is classic asp & actually master page is included at the last of the the child page like

    #include file="Templates/Master.asp"

    now i just have to make a variable that can be accessed to master.asp, then i will just print that value on title tag on master page.

    Please just help how to pass that variable ? or simply a defined variable in child.asp is accessible in master.asp?
     
    ranacseruet, May 5, 2009 IP
  7. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #7
    maybe:
    #include file="Templates/Master.asp?title=Page title here"

    Then within the master.asp
    <head>
    <title><% Response.Write Request.QueryString("title") %></title>
    </head>
     
    camjohnson95, May 5, 2009 IP
  8. ranacseruet

    ranacseruet Peon

    Messages:
    302
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Thanks, it helped me a lot.
     
    ranacseruet, May 6, 2009 IP