日期:2014-05-17 浏览次数:20604 次
ListDeptCategory = ViewState["ListDeptCategory"] as IList;
int iCount = ListDeptCategory.Count; //所有部门
for (int i = 1; i <= 1; i++)
{
CategoryInfo catItemInfo = ListDeptCategory[i - 1] as CategoryInfo;
GridView deptGridControl = CreateOneGrid(catItemInfo.CategoryCode, GridType.DeptGrid, true, true, dt);
deptGridControl.DataBind();
plDeptContainer.Controls.Add(deptGridControl);
}
/// <summary>
/// 创建一个GRID
/// </summary>
/// <param name="gridName">需要创建的GRID名称</param>
/// <param name="gridType">GRID类型【GridType】 是部门还是商品分类的</param>
/// <param name="isShowFooter">是否显示汇总</param>
/// <returns></returns>
private GridView CreateOneGrid(string gridName, GridType gridType, bool isShowFooter, bool isShowSaleMoney, DataTable dt)
{
GridView oneGridView = new GridView();
oneGridView.DataSource = dt;
oneGridView.HeaderStyle.Font.Bold = true;
oneGridView.AutoGenerateColumns = false;//设置自动产生列为false
oneGridView.ID = gridName + "view";
BoundField theCol = null;
theCol = new BoundField();
theCol.HeaderText = "商品分类";
theCol.Visible = true;
theCol.DataField = "CategoryName";
oneGridView.Columns.Add(theCol);
theCol = new BoundField();
theCol.HeaderText = "销售总额";
theCol.Visible = true;
theCol.DataField = "saleMoney";
oneGridView.Columns.Add(theCol);
oneGridView.DataBind();
return oneGridView;
}
public override void CreateView() {
base.CreateView();
this.gvwQuery.RowDblClick += new GridViewPlus.RowDblClickEventHandler(gvwQuery_RowDblClick);
&nb