private void BindGrid(ExtAspNet.Grid grid, DataTable dtResult) { // 1.设置总项数 grid.RecordCount = dtResult.Rows.Count; // 2.获取当前分页数据 DataTable paged = dtResult.Clone(); int rowbegin = grid.PageIndex * grid.PageSize; int rowend = (grid.PageIndex + 1) * grid.PageSize; if (rowend > dtResult.Rows.Count) { rowend = dtResult.Rows.Count; } for (int i = rowbegin; i < rowend; i++) { paged.ImportRow(dtResult.Rows[i]); } // 3.绑定到Grid grid.DataSource = paged; grid.DataBind(); }
public GridRow(Grid grid, object dataItem, int rowIndex) { _grid = grid; _dataItem = dataItem; _rowIndex = rowIndex; }