Trying to create a list to return some JSON data to a view. Following a few tutorials on the web that were created during the beta but it seems in the RC the code does work.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MvcApplication6.Controllers
{
[HandleError]
public class HomeController : Controller
{
public JsonResult list()
{
List<ListItem> list = new List<ListItem> {
new ListItem() {Name="value", Something = "more Values"}
};
return Json(List);
}
}
}
The problem is ListItem is not found in the System.Web.Mvc namespace. I can't seem to get this to work. If ListItem has been removed how do you accomplish this in Release Candidate MVC?
Here are the tutorials I am trying to use:
http://geekswithblogs.net/michelotti/archive/2008/06/28/mvc-json---jsonresult-and-jquery.aspx http://nayyeri.net/blog/using-jsonresult-in-asp-net-mvc-ajax/