//GridView不能重写DataBind /// <summary> /// 生成数据源,在任何设置完成后,DataBind()之前执行 /// </summary> public void CreateDataSource() { string recordCountSql = query.CreateGetRecordCountSql(); this.pager.RecordCount = db.ExecuteScalar(recordCountSql).ToArrowInt(); pager.CaculatePageCount(); string pageSql = query.CreatePagerSql(db.ProviderName, pager); this.DataSource = db.ExecuteDataSet(pageSql); }
public override void DataBind() { if (!DesignMode) { string recordCountSql = query.CreateGetRecordCountSql(); this.pager.RecordCount = db.ExecuteScalar(recordCountSql).ToArrowInt(); pager.CaculatePageCount(); string pageSql = query.CreatePagerSql(db.ProviderName, pager); this.DataSource = db.ExecuteDataSet(pageSql); } base.DataBind(); }