I have a specific ViewBag property that I would like to set at the ViewStart level. Ideally, I would like to be able to override that property on a page basis, if necessary. Is this possible? If so, how do I access the ViewBag property within a ViewStart page?
相关问题
- TextBoxFor decimal
- How to do an inline style with asp.net mvc 3 razor
- Issue with updating model on AJAX “POST”
- Value cannot be null or empty.\r\nParameter name:
- Should one try to guard against null reference exc
相关文章
- Breakpoint in ASP.NET MVC Razor view will not be h
- How to define function that returns html in asp.ne
- MVC 3 Razor - Trigger validation from controller
- Where to configure Razor page language version to
- MVC submit button not firing
- How can I use Enums on my Razor page in MVC3?
- how to access querystring in ASP.Net MVC View?
- How to use JSON data in a view?
There are two way to do this:
Use the
PageData
property (it's something more applicable to ASP.NET WebPages and seldom used in MVC)Set:
Retrieve
Try to find the view instance (the code is a bit dirty, but it does give you access directly to
ViewBag
/ViewData
Set:
Retrieve: as per usual