你好,下面是Group的代码:- protected void Page_Load(object sender, EventArgs e)
- {
- DataTable dt = new DataTable();
- dt.Columns.Add("col1");
- dt.Columns.Add("col2");
- dt.Columns.Add("col3");
- dt.Columns.Add("col4");
- dt.Rows.Add("asdf", "1", "1", "2");
- dt.Rows.Add("asdf", "2", "5", "6");
- dt.Rows.Add("adfer", "4", "1", "2");
- dt.Rows.Add("tyj", "7", "1", "2");
-
- this.FpSpread1.DataSource = dt;
- this.FpSpread1.DataBind();
- if (!IsPostBack)
- {
- FarPoint.Web.Spread.Model.GroupDataModel gm = new FarPoint.Web.Spread.Model.GroupDataModel(FpSpread1.ActiveSheetView.DataModel);
- FarPoint.Web.Spread.SortInfo[] sort = new FarPoint.Web.Spread.SortInfo[1];
- sort[0] = new FarPoint.Web.Spread.SortInfo(0, true);
- gm.Group(sort);
- FpSpread1.ActiveSheetView.DataModel = gm;
- }
- }
复制代码 最终效果:
adf.png
(20.17 KB, 下载次数: 334)
|