Top "Viewbag" questions

ViewBag is a dynamic type object in the ASP.

MVC Pass ViewBag to Controller

I have a Viewbag that is a list that I am passing from the Controller to the View. The Viewbag …

c# asp.net-mvc model-view-controller razor viewbag
How to populate javascript variable with JSON from ViewBag?

I have this Index action: public ActionResult Index() { var repo = (YammerClient) TempData["Repo"]; var msgCol = repo.GetMessages(); ViewBag.User = repo.…

javascript asp.net asp.net-mvc json viewbag
ViewBag/ViewData Lifecycle

I have seen many posts about when to use ViewBag/ViewData vs ViewModel but i have not been able to …

asp.net-mvc-3 viewbag
Select a default value in dropdownlistfor MVC 4

I'm trying to make a dropdownlistfor with a selected value but it doesn't work :/ And I search on the web …

asp.net-mvc-4 razor html.dropdownlistfor viewbag
Alternative to ViewBag.Title in ASP.NET MVC 3

By default the new project template for ASP.NET MVC 3 adds the following to the default layout (masterpage in razor): &…

asp.net-mvc-3 razor viewbag
MVC: Iterating a Viewbag array in javascript

The goal is to get the data from the ViewBag.Array to a Javascript array. The data is calculated in …

javascript asp.net-mvc arrays razor viewbag
Store a value in ViewBag from javascript

How can I store a value in the ViewBag accessing it from javascript?

javascript asp.net-mvc-3 viewbag
Setting text input's value from ViewBag? ASP.NET MVC5

I am passing a variable ViewBag.crimeRef from my controller and am using it to display a message which works …

asp.net asp.net-mvc viewbag
Does a child action share the same ViewBag with its "parents" action?

I am confused with this: I have an action ,say Parent ,and in the corresponding view file ,I have called …

asp.net-mvc-3 viewbag child-actions
MVC ViewBag Best Practice

For the ViewBag, I heard it was a no-no to use. I would assume have the content from the ViewBag …

asp.net-mvc razor viewbag