jeudi 25 juin 2015

Managing ViewBag state from controller, view, partial views & layout

I'm not understanding how ViewBag state is managed between the controller, view, partial views, _ViewStart and layouts.

In particular, in _ViewStart.cshtml I set

      Layout = "~/Views/Shared/_Layout.cshtml";
      ViewContext.ViewBag.Title = "Default Title";

Yet, in _Layout.cshtml the

ViewBag.Title is not defined

Should it not be defined?

Aucun commentaire:

Enregistrer un commentaire