Scott McCulloch posted on June 08, 2005 16:34

A DotNetNuke page contains many modules and set's its title (the label shown in your browser window) from the information about the current page. This information is usually the page title (or page name if no title specified).
Sometimes it's useful however to dynamically set this value from within a module, a good example is my
news articles module which dynamically set's the page title based on the title of the article. Another example is the latest version of
Active Forums.
To change the title is relatively simple, each module is a user control and all user controls belong to a page (so we should be able to get a reference to that page from our module/user control).
The base page for DotNetNuke is a special class within DotNetNuke (CDefault) and has additional properties not found in the traditional page class (System.Web.UI.Page). These additional properties contain a property for title.
So the first step I do is to create a property representing a reference to this class:-
Public ReadOnly Property BasePage() As DotNetNuke.Framework.CDefault Get Return CType(Me.Page, DotNetNuke.Framework.CDefault) End GetEnd PropertyThe above bit of code exposes a property that casts the module's page reference to the correct class. (I think that maybe this property should belong in PortalModuleBase so doing the above step would be unnecessary).
Now the easy part, from our module we can now do:-
Me.BasePage.Title = "My Custom Title"That's it! There are quite a few other properties in the CDefault class you can take advantage of, for my
news articles module, I was able to add additional CSS references for my method templating.