protected void Page_Load(object sender, EventArgs e) { SrnprWeb.WebEntity.GridShowWWE gsw = new SrnprWeb.WebEntity.GridShowWWE(); gsw.ColumnList = new List<SrnprWeb.WebEntity.GridShowColumnWWE>(); gsw.ParamList = new List<SrnprWeb.WebEntity.GridShowParamWWE>(); gsw.TableInfo = new SrnprWeb.WebEntity.GridShowDataWWE(); gsw.ColumnList.Add(new SrnprWeb.WebEntity.GridShowColumnWWE() { HeaderText = "表头1", ColumnData = "" }); GSShow.GridShowEntity = gsw; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty( Request["id"]) ) { TBId.Enabled = false; var x = SrnprWeb.WebProcess.GridShowWWP.GetEntityById(Request["id"].Trim()); TBTableName.Text = x.TableInfo.TableName; TBDataBaseId.Text = x.TableInfo.DataBaseId; TBId.Text = x.Id.Trim(); tbDescription.Text = x.Description.Trim(); GSEntity = x; BindDataColumn(); BindParams(); } else { SrnprWeb.WebEntity.GridShowWWE gsw = new SrnprWeb.WebEntity.GridShowWWE(); gsw.TableInfo = new SrnprWeb.WebEntity.GridShowDataWWE(); gsw.ParamList = new List<SrnprWeb.WebEntity.GridShowParamWWE>(); gsw.ColumnList = new List<SrnprWeb.WebEntity.GridShowColumnWWE>(); gsw.Guid = Guid.NewGuid().ToString(); GSEntity = gsw; } } if (!string.IsNullOrEmpty(Request["submittype"])) { string sId = Request["submitid"].Trim(); switch (Request["submittype"].Trim()) { case "d_d": GSEntity.ColumnList.Remove(GSEntity.ColumnList.SingleOrDefault(t => t.Guid == sId)); BindDataColumn(); break; case "d_p": GSEntity.ParamList.Remove(GSEntity.ParamList.SingleOrDefault(t => t.Guid == sId)); BindParams(); break; } } }
/// <summary> /// /// Description: 根据表得到信息 /// Author:Liudpc /// Create Date: 2010-8-30 13:53:39 /// </summary> /// <param name="gsw"></param> /// <param name="req"></param> /// <param name="pro"></param> /// <returns></returns> public DataTable GetDataByTable(GridShowWWE gsw, GridShowRequestWWE req, WidgetProcessWWE pro) { DataTable dtSource = pro.DataInfo; req.RowsCount = dtSource.Rows.Count; DataTable dtNew = new DataTable(); for (int i = 0, j = dtSource.Columns.Count; i < j; i++) { dtNew.Columns.Add(dtSource.Columns[i].ColumnName); } for (long i = (req.PageIndex - 1) * req.PageSize, j = Math.Min(req.PageIndex * req.PageSize, req.RowsCount); i < j; i++) { dtNew.Rows.Add(dtSource.Rows[(int)i].ItemArray); } return dtNew; }