The question may be likely duplication. It is not possible to access the ViewBag in a partial view in ASP.NET MVC3 , but it does not seem to categorically deny the possibility.
The problem is the access of ViewBag data in a partial view, which is called from the view and passed to the model, for example.
@Html.Partial("name", object);
The Action method for the main view from which this partial view is called has the ViewBag property. That the ViewBag doesn't seem to be available with a Partial view.
Any help is appreciated.
source share