<TITLE> tag value server side
-
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
-
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
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>
-
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
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.PageProtected pageTitle As System.Web.UI.HtmlControls.HtmlGenericControl
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.LoadpageTitle.InnerText = "Dynamic page Title"
End Sub
End ClassNow you can get/set the page title by using: PageTitle.InnerText = "This is my page title" Hope that helps. Jon G www.Gizmocoder.com
-
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
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.PageProtected pageTitle As System.Web.UI.HtmlControls.HtmlGenericControl
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.LoadpageTitle.InnerText = "Dynamic page Title"
End Sub
End ClassNow you can get/set your page title by doing the following: PageTitle.Innertext = "Text to display" Hope that helps. Jon G www.Gizmocoder.com