public virtual JsonResult DynamicGridData(int page, int rows, String search, String sidx, String sord) { int pageIndex = Convert.ToInt32(page) - 1; int pageSize = rows; ICriteria searchCriteria = pluginLocaleService.GetSearchCriteria(search); int totalRecords = PluginHelper.CountAvailablePlugins(searchCriteria); var totalPages = (int)Math.Ceiling((float)totalRecords / pageSize); var plugins = PluginHelper.GetAvailablePlugins(searchCriteria.SetMaxResults(pageSize).SetFirstResult(pageIndex * pageSize).AddOrder(sord == "asc" ? Order.Asc(sidx) : Order.Desc(sidx))); var jsonData = new { total = totalPages, page, records = totalRecords, rows = plugins.Select(pluginLocale => new { id = JqGridConstants.NotClickableId, cell = new[] { pluginLocale.Title, pluginLocale.Description, pluginLocale.Plugin.CreateDate.ToLongDateString(), pluginLocale.Plugin.Status.ToString(), pluginLocale.Plugin.Status.Equals(PluginStatus.NotInstalled) ? String.Format(JqGridConstants.UrlTemplate, Url.Action(MVC.Admin.Module.Install(pluginLocale.Plugin.Id)), Translate("Actions.Install")) : pluginLocale.Plugin.Status.Equals(PluginStatus.Installed) ? String.Format(JqGridConstants.UrlTemplate, Url.Action(MVC.Admin.Module.Uninstall(pluginLocale.Plugin.Id)), Translate("Actions.Uninstall")) : String.Empty, String.Format(JqGridConstants.UrlTemplate, Url.Action(MVC.Admin.Module.Edit(pluginLocale.Plugin.Id)), Translate("Actions.Edit")) } }).ToArray() }; return(Json(jsonData)); }