public virtual JsonResult LoadData(int page, int rows, String search, String sidx, String sord) { int pageIndex = Convert.ToInt32(page) - 1; int pageSize = rows; ICriteria searchQuery = sectionLocaleService.GetSearchCriteria(search, this.CorePrincipal(), (Int32)SectionOperations.View); long totalRecords = sectionLocaleService.Count(searchQuery); var totalPages = (int)Math.Ceiling((float)totalRecords / pageSize); var sections = searchQuery.AddOrder(new Order(sidx, sord == "asc")).SetFirstResult(pageIndex * rows).SetMaxResults(rows).List <SectionLocale>(); var jsonData = new { total = totalPages, page, records = totalRecords, rows = ( from section in sections select new { id = section.Id, cell = new[] { section.Title, String.Format("<a href=\"{0}\">{1}</a>", Url.Action("Edit", "Section", new { sectionId = section.Section.Id }), HttpContext.Translate("Details", ResourceHelper.GetControllerScope(this))) } }).ToArray() }; return(Json(jsonData)); }