I would suggest using jqGrid (or maybe some other network of java scripts). From the MVC, return an ActionResult as a JSON object
public ActionResult UserList() { object userListData = null; try { List<UserListViewModel> users = 'your code to get the user list' userListData = new { page = 1, records = users.Count, rows = users }; } JavaScriptSerializer serializer = new JavaScriptSerializer(); serializer.MaxJsonLength = int.MaxValue; return new ContentResult() { Content = serializer.Serialize(userListData), ContentType = "application/json", }; }
and call it on the load / jQuery page document Get ready for things like this.
$("#userTable").jqGrid({ url: '../User/UserList, mtype: 'GET', datatype: "json", autowidth: true, colNames: ['Id', 'First Name', 'Last Name'], colModel: [ { name: 'Id', key: true, hidden: true, fixed: false, shrinkToFit: false, align: 'left' }, { name: 'FirstName', fixed: false, shrinkToFit: false, align: 'left' }, { name: 'LastName', fixed: false, shrinkToFit: false, align: 'left' } ],
for more information about jqGrid, see the demo version of http://jqgrid.com/
source share