Top "Viewdata" questions

ViewData is a dictionary used in C# MVC to pass data from the controller to the view.

What's the difference between ViewData and ViewBag?

I saw the ViewBag in MVC 3. How's that different than ViewData in MVC 2?

.net asp.net-mvc-3 difference viewbag viewdata
There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key 'xxx'

There are a couple of posts about this on Stack Overflow but none with an answer that seem to fix …

asp.net-mvc ienumerable drop-down-menu viewdata selectlist
Pass Additional ViewData to a Strongly-Typed Partial View

I have a strongly-typed Partial View that takes a ProductImage and when it is rendered I would also like to …

c# asp.net asp.net-mvc asp.net-mvc-partialview viewdata
Html.HiddenFor value property not getting set

I could have used @Html.HiddenFor(x=> ViewData["crn"]) but, I get, <input id="ViewData_crn_" name="ViewData[…

asp.net-mvc razor viewdata html.hiddenfor
How to set ViewBag properties for all Views without using a base class for Controllers?

In the past I've stuck common properties, such as the current user, onto ViewData/ViewBag in a global fashion by …

asp.net-mvc asp.net-mvc-3 autofac viewdata
Populating a dropdown from ViewData

I have viewdata in my controller which is populated by a list: List<employee> tempEmpList = new List<…

asp.net-mvc asp.net-mvc-3 razor viewdata
asp.net mvc. Passing a list via viewData

Hi does anyone know how to pass a list throught the "ViewData". This is what I'm trying but I think …

asp.net-mvc list viewdata
ASP.NET MVC Passing Raw HTML from Controller to View

I have been scratching my head about this for a few days, and I am not sure if it is …

c# html asp.net-mvc decode viewdata
ASP.NET MVC - How to pass an Array to the view?

I'm struggling myself here, to find a easy way to pass an array from the controller to the view on …

asp.net asp.net-mvc arrays viewdata
Argh! Why does System.Web.Mvc.HandleErrorInfo get passed to my views?

I'm experiencing a rather frustrating problem. My MVC site runs fine for the most part, but randomly throws an error (…

c# asp.net-mvc controller views viewdata