Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Changing Title Programmatically

Changing Title Programmatically

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nethelptutorialquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Josh Koppang
    wrote on last edited by
    #1

    Does anyone know how to set the title of an ASP.NET page from a code behind file at runtime (obviously)? I noticed there is a 'runat' and 'id' attribute, but I cannot successfully change the title. Any help would be appreciated. Thanks in advance, Josh There's a fine line between confidence and arrogance.

    T 1 Reply Last reply
    0
    • J Josh Koppang

      Does anyone know how to set the title of an ASP.NET page from a code behind file at runtime (obviously)? I noticed there is a 'runat' and 'id' attribute, but I cannot successfully change the title. Any help would be appreciated. Thanks in advance, Josh There's a fine line between confidence and arrogance.

      T Offline
      T Offline
      Thea Burger
      wrote on last edited by
      #2

      In your HTML, for the title tag, do the following: In the code window declare the title tag: protected System.Web.UI.HtmlControls.HtmlGenericControl myTitle; And when you want to set the text, use this: myTitle.InnerText = "Welcome to my site!"; -Thea-

      T 1 Reply Last reply
      0
      • T Thea Burger

        In your HTML, for the title tag, do the following: In the code window declare the title tag: protected System.Web.UI.HtmlControls.HtmlGenericControl myTitle; And when you want to set the text, use this: myTitle.InnerText = "Welcome to my site!"; -Thea-

        T Offline
        T Offline
        Thea Burger
        wrote on last edited by
        #3

        Oops! Let's try again... In your HTML, do this:

        J N 2 Replies Last reply
        0
        • T Thea Burger

          Oops! Let's try again... In your HTML, do this:

          J Offline
          J Offline
          Josh Koppang
          wrote on last edited by
          #4

          Thank you. I knew it was something simple, but I hadn't tried the GenericControl. Thanks again, Josh There's a fine line between confidence and arrogance.

          1 Reply Last reply
          0
          • T Thea Burger

            Oops! Let's try again... In your HTML, do this:

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #5

            Theres also this way <title><%=Title%></title> protected string Title { get{ return = "My Title" } }

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups