Search code examples
asp.netmaster-pagesdotvvm

Global object in DotVVM (for masterpage)


I'm looking for some global object in DotVVM framework as ViewBag in Asp.Net MVC. I wanna have a masterpage with dynamic title and I don't know how could I do this.

For example: In asp.net MVC "ViewBag.Title" -> where Title is property from view(model) and when I am changing articles, title changes too.


Solution

  • We have nothing like ViewBag in DotVVM. However, all viewmodels of pages which use the master page, must inherit from the viewmodel of the master page, so just place the Title property in the master page's viewmodel and you'll have it available in all content pages. You can set it e.g. in the constructor of each viewmodel.