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. <TITLE> tag value server side

<TITLE> tag value server side

Scheduled Pinned Locked Moved ASP.NET
csharphtmlcomsysadminhelp
4 Posts 3 Posters 1 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
    Jonathan Craig
    wrote on last edited by
    #1

    How can you get the value of the page's HTML TITLE tag in .NET server side code? Thanks for any help...:confused: Jonathan Craig mcw-tech.com

    T J 3 Replies Last reply
    0
    • J Jonathan Craig

      How can you get the value of the page's HTML TITLE tag in .NET server side code? Thanks for any help...:confused: Jonathan Craig mcw-tech.com

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

      Don't know of a quick solution, but what you can use is something like a screen scrape, where you get all the html, and then use a regular expression to find the tag. Try <a href="http://www.dotnetjohn.com/articles/articleid93.aspx">this example</a>[<a target=_blank title='New Window' href="http://www.dotnetjohn.com/articles/articleid93.aspx">^</a>]. HTH, Thea </x-turndown>

      1 Reply Last reply
      0
      • J Jonathan Craig

        How can you get the value of the page's HTML TITLE tag in .NET server side code? Thanks for any help...:confused: Jonathan Craig mcw-tech.com

        J Offline
        J Offline
        Jon G
        wrote on last edited by
        #3

        Here is some information that may be useful to you. In order to get/set the page title dynamically during runtime, you can do something like this inside your code: HTML File:

        VB CodeBehind file:

        Public Class MyPage
        Inherits System.Web.UI.Page

        Protected pageTitle As System.Web.UI.HtmlControls.HtmlGenericControl

        Private Sub Page_Load(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles MyBase.Load

        pageTitle.InnerText = "Dynamic page Title"
        

        End Sub
        End Class

        Now you can get/set the page title by using: PageTitle.InnerText = "This is my page title" Hope that helps. Jon G www.Gizmocoder.com

        1 Reply Last reply
        0
        • J Jonathan Craig

          How can you get the value of the page's HTML TITLE tag in .NET server side code? Thanks for any help...:confused: Jonathan Craig mcw-tech.com

          J Offline
          J Offline
          Jon G
          wrote on last edited by
          #4

          My first post somehow got merged into the same post, along with Thea's post. VERY weird. Nevertheless, here is my post again to avoid confusion. Here is a simple way to get/set your page title during runtime. HTML file:

          VB Codebehind file:

          Public Class MyPage
          Inherits System.Web.UI.Page

          Protected pageTitle As System.Web.UI.HtmlControls.HtmlGenericControl

          Private Sub Page_Load(ByVal sender As System.Object, _
          ByVal e As System.EventArgs) Handles MyBase.Load

          pageTitle.InnerText = "Dynamic page Title"
          

          End Sub
          End Class

          Now you can get/set your page title by doing the following: PageTitle.Innertext = "Text to display" Hope that helps. Jon G www.Gizmocoder.com

          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