ASP.NET - Dynamic titles
Great tip from Ashutosh Nilkanth to programatically change the title of an ASP.NET page:
As I learnt today, the title (browser window title) of an ASP.NET page can be changed programatically. Here how ...
In the HEAD section of the ASP.NET page (.aspx) define the title as a server side control:
... and in the code-behind (.aspx.vb) or inline code, define ...
Protected PageTitle As New HtmlGenericControl
... and set the title from anywhere in the code as ...
Me.PageTitle.InnerText = "Hello World"
A cool technique to implement for a template-driven UI.
I used to do this by other ways such as Master Pages or string replacements, but this is very clean.
This technique works well for CSS links too, you just have to close the LINK tag.