public ActionResult InitGrid(int page, int rows, string search, string sidx, string sord) { string ModuleCode = Request["ModuleCode"] == null ? "" : Request["ModuleCode"].ToString(); string NameSpace = Request["NameSpace"] == null ? "" : Request["NameSpace"].ToString(); string LoginId = Request["userid"] == null ? "" : Request["userid"].ToString(); // session string deptid = Request["deptid"] == null ? "" : Request["deptid"].ToString(); // session string filters = Request["filters"] == null ? "" : Request["filters"].ToString(); string Inlinetype = Request["itype"] == null ? "0" : Request["itype"].ToString(); string GeneralType = Request["type"] == null ? "0" : Request["type"].ToString(); string record = Request["record"] == null ? "" : Request["record"]; string filtersSql = "1=1"; if (!string.IsNullOrEmpty(filters)) { filtersSql = filters.BuildSearch(ModuleCode); //filtersSql = BulidJqGridSearch.BuildSearch(filters); //动态查询入口更改,查询结果后进行筛选 //filtersSql = ""; } //临时赋值 LoginId = SessionConfig.UserId(); deptid = SessionConfig.DeptId(); //预留两个自定义参数 Dictionary <String, String> param = new Dictionary <string, string>(); param.Add("@Page", page.ToString()); param.Add("@Rows", rows.ToString()); param.Add("@Search", filtersSql); //查询字段 param.Add("@Sidx", sidx); //排序字段 param.Add("@Sord", sord); //排序 ASC DESC param.Add("@ModuleCode", ModuleCode); //模块编码 param.Add("@NameSpace", NameSpace); //模块命名空间 param.Add("@Userid", LoginId); param.Add("@Deptid", deptid); param.Add("@InlineType", Inlinetype); param.Add("@GeneralType", GeneralType); //获取所有的数据列 var dt = instance.GetListPageAllRecords(ModuleCode, NameSpace, param); if (!string.IsNullOrEmpty(record)) { dt = FilterDataTable(dt, "Record_ID='" + record + "'"); } DataTable newDt = GetPagedTable(dt, page, rows, ModuleCode); //newDt.DefaultView.Sort = " CreateDate DESC "; //DataTable newDt = DataTablePage.GetPagedTable(dt, page, rows); //var json = DataTablePage.JsonForJqgrid(newDt, page, rows, dt.Rows.Count); var json = Bll_Comm.JsonForJqgrid(ModuleCode, newDt, page, rows, dt.Rows.Count); return(JavaScript(json)); }