Trying to set or get some value to/from ViewBag in _ViewStart.cshtml will throw an error when you run the app. There is a workaround for this using ViewContext.Controller.ViewBag.
Here is some sample code
ViewContext.Controller.ViewBag.StoreName = "My New Store"; ... @ViewContext.Controller.ViewBag.StoreName
No comments:
Post a Comment