两个C1gridview怎么同步排序
protected voiddgMst_Sorting(object sender, C1.Web.Wijmo.Controls.C1GridView.C1GridViewSortEventArgs e) { DataTable dtSource = HttpContext.Current.Session["HolidayApply" + CommConst.PAGE_DATASOURCE_SESSION]as DataTable;//从session中取得 if (dtSource == null) { return; } if (0 == dtSource.Rows.Count) { return; } string field = e.SortExpression; if (e.SortDirection.ToString()== "Ascending") { DataRow[] rows = dtSource.Select("", field + "asc"); DataTable dt2 = dtSource.Clone(); dt2.Clear(); int i = 1; foreach (DataRow row in rows) { row["rowno"] = i; i++; dt2.ImportRow(row); } dtSource = dt2; SessionOperate.SaveToSession("HolidayApply" + CommConst.PAGE_DATASOURCE_SESSION,dtSource); } else if (e.SortDirection.ToString()== "Descending") { DataRow[] rows = dtSource.Select("", field + "desc"); DataTable dt2 = dtSource.Clone(); dt2.Clear(); int i = 1; foreach (DataRow row in rows) { row["rowno"] = i; i++; dt2.ImportRow(row); } dtSource = dt2; SessionOperate.SaveToSession("HolidayApply" + CommConst.PAGE_DATASOURCE_SESSION,dtSource); } ShowPage(pager1.CurrentIndex); }
|