Henrik Elkjær Hagen - 105 - Apr 24, 2014

I have a web page that is similar to http://razor.servicestack.net/rockstars
Now I want to set the title on the page using a value from a database or a config file. I can’t add this value to the “RockstarsResponse” model.
How can I achieve this?
Do I have to use some javascript to do another request for the title string? 

I want to have the same title on all or most of my pages. Is it possible to use a _layout page and make that page fetch the title string?

Henrik Elkjær Hagen:

Might be easier than I thought.
If I’m getting the title from the web.config I think I could just do this in the _layout file:

Henrik Elkjær Hagen:

The code above worked. 
And to get the title from the database I did this:
   var dbTitle = "MyTitle - ";
    using (Db)
        title += Db.Single<Setting>(s => s.Name ==  “LocationName”).Value;