I have created two method like
public ActionResult getdata(List lst )         {             UserModel usermodel = new UserModel();             UserService uservice = new UserService();             //return View(db.VideoModels.OrderByDescending(v => v.VideoId).ToPagedList(page, 3));             string[] columnNames = (string[])TempData["columnname"];               lst = new List();             lst = uservice.GetAllUsers();                     JavaScriptSerializer serializer = new JavaScriptSerializer();             List> rows = new List>();             Dictionary row;             foreach (var dr in lst)             {                 row = new Dictionary();                      rows.Add(row);             }             return Json(serializer.Serialize(lst), JsonRequestBehavior.AllowGet);         }                            public ActionResult GetColumnDetails( List lst)         {             UserModel usermodel = new UserModel();             UserService uservice = new UserService();             //return View(db.VideoModels.OrderByDescending(v => v.VideoId).ToPagedList(page, 3));                                      lst = new List();             lst = uservice.GetAllUsers();             //   id =  (int)Session["id"] ;             //  dt = GetTableDetails(id);                             //string[] columnNames = lst.             //                     Select(x => x.)             //                     .ToArray();             //string[] columnNames = (from ss in lst.GetType().GetProperties() select ss.Name).ToArray();             //string colNames = string.Empty;             var listOfStrings = new List();               // do stuff...              string[] colNames = listOfStrings.ToArray();             string[] columnNames = (from t in typeof(PrTblUsers).GetProperties() select t.Name).ToArray();                          JavaScriptSerializer serializer = new JavaScriptSerializer();             return Json(serializer.Serialize(colNames= columnNames), JsonRequestBehavior.AllowGet);            }t);            }
 getGetColumnDetails is for getting the column header and getdata is for getiing records.
In the view i use like this
div class="row">

@*
*@