Changing the pages title

Discussion in 'ASP .Net' started by Michael Groeger, Jan 11, 2006.

  1. Hi all,

    is there a way to change the title of a page dynamically from code-behind?

    Regards,
    Michael
     
    Michael Groeger, Jan 11, 2006
    #1
    1. Advertising

  2. I usually use <title><%= this._title %></title> to workaround. Just set the
    _title(string type of course) to set the title of the page.

    This works because Render() is always the last method to run to the cycle.

    In .NET 2.0, you can set the Page.Title property directly.

    "Michael Groeger" <> ¼¶¼g©ó¶l¥ó·s»D:...
    > Hi all,
    >
    > is there a way to change the title of a page dynamically from code-behind?
    >
    > Regards,
    > Michael
    >
    >
     
    Lau Lei Cheong, Jan 11, 2006
    #2
    1. Advertising

  3. I use
    <title runat="server" id="title" />

    protected HtmlGenericControl title;

    title.InnerText = "whatever";

    Karl
    --
    http://www.openmymind.net/



    "Lau Lei Cheong" <> wrote in message
    news:...
    >I usually use <title><%= this._title %></title> to workaround. Just set the
    >_title(string type of course) to set the title of the page.
    >
    > This works because Render() is always the last method to run to the cycle.
    >
    > In .NET 2.0, you can set the Page.Title property directly.
    >
    > "Michael Groeger" <>
    > ¼¶¼g©ó¶l¥ó·s»D:...
    >> Hi all,
    >>
    >> is there a way to change the title of a page dynamically from
    >> code-behind?
    >>
    >> Regards,
    >> Michael
    >>
    >>

    >
    >
     
    Karl Seguin [MVP], Jan 11, 2006
    #3
  4. Oops. I thought the HtmlGenericControl only affects tags in <body>. :p

    Have learnt new thing now...

    "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
    net> ¼¶¼g©ó¶l¥ó·s»D:...
    >I use
    > <title runat="server" id="title" />
    >
    > protected HtmlGenericControl title;
    >
    > title.InnerText = "whatever";
    >
    > Karl
    > --
    > http://www.openmymind.net/
    >
    >
    >
    > "Lau Lei Cheong" <> wrote in message
    > news:...
    >>I usually use <title><%= this._title %></title> to workaround. Just set
    >>the _title(string type of course) to set the title of the page.
    >>
    >> This works because Render() is always the last method to run to the
    >> cycle.
    >>
    >> In .NET 2.0, you can set the Page.Title property directly.
    >>
    >> "Michael Groeger" <> ¼¶¼g©ó¶l¥ó·s»D:...
    >>> Hi all,
    >>>
    >>> is there a way to change the title of a page dynamically from
    >>> code-behind?
    >>>
    >>> Regards,
    >>> Michael
    >>>
    >>>

    >>
    >>

    >
    >
     
    Lau Lei Cheong, Jan 12, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Klemt
    Replies:
    1
    Views:
    492
    Steve C. Orr, MCSD
    Aug 10, 2003
  2. Replies:
    0
    Views:
    573
  3. Replies:
    1
    Views:
    588
    David
    Apr 24, 2007
  4. soonic
    Replies:
    11
    Views:
    1,845
    soonic
    Jul 27, 2011
  5. Russell
    Replies:
    2
    Views:
    326
    Russell
    Sep 13, 2004
Loading...

Share This Page