Top "Viewdata" questions

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

Using ViewData to pass string from Controller to View in ASP.NET MVC3

I am trying to pass a random string from my Controller to the View. Here is my Controller code: [HttpPost] …

asp.net-mvc-3 viewdata
ASP.NET MVC ViewData if statement

I use the following in my View to check if a query exists like domain.com/?query=moo if (!string.…

asp.net-mvc viewdata
ViewBag vs ViewData performance difference in MVC?

I know that ViewData and ViewBag both use the same backing data and that neither are as good as using …

asp.net-mvc performance asp.net-mvc-3 viewdata viewbag
keep viewdata on RedirectToAction

[AcceptVerbs(HttpVerbs.Post)] public ActionResult CreateUser([Bind(Exclude = "Id")] User user) { ... db.SubmitChanges(); ViewData["info"] = "The account has been created."; …

asp.net-mvc viewdata redirecttoaction
Using ViewData to pass data from Controller to View

I'm trying to pass data from a controller to view, and display these data. But after many tries I can't. …

c# asp.net-mvc viewdata
What is the best way to create dropdownlists in MVC 4?

I want to know,What is a best way to create dropdownlists in MVC 4? With ViewBag or another approach?

asp.net-mvc-4 html.dropdownlistfor html-select viewdata viewbag
There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key 'Carrera'

I'm having trouble when handling the Post request for my controller: [HttpGet] public ActionResult Crear() { CarreraRepository carreraRepository = new CarreraRepository(); var …

c# asp.net-mvc-2 drop-down-menu viewdata
ASP.NET MVC - Pass Json String to View using ViewData

I'm trying to pass Json to my View using ViewData Controller ViewData("JsonRegionList") = Json(RegionService.GetActiveRegions()) view $("input#UserRegion").autocomplete({ …

json asp.net-mvc-2 viewdata jsonresult
How to pass value by ViewData to Editor Template by @Html.EditorFor

In the view strongly typed view against @model System.Tuple<Person, List<Survey>> I use inside …

.net asp.net-mvc razor viewdata
Maintaining ViewBag values while posting data

I have a logical question that needs to be answered!! Here is a scenario.. -In controller ViewBag.Name = "aaaa"; -In …

c# jquery asp.net-mvc-4 viewbag viewdata