private void BindGrid() { int month = int.Parse(ddl_Month.SelectedValue); int organizecity = int.Parse(tr_OrganizeCity.SelectValue); DataTable dt = PM_PromotorBLL.GetAnalysisOverview(organizecity, month); if (dt.Columns.Count > 0) { dt.Columns.Remove("Promotor"); dt.Columns.Remove("ClientID"); dt.Columns.Remove("BPMID"); dt.Columns.Remove("BRTID"); dt.Columns.Remove("取消人"); dt.Columns.Remove("取消人职务"); dt.Columns.Remove("取消时间"); } // ViewState["dtSummary"] = dt; gv_List.DataSource = dt; gv_List.DataBind(); if (dt.Columns.Count >= 24) { gv_List.Width = new Unit(dt.Columns.Count * 65); } else { gv_List.Width = new Unit(100, UnitType.Percentage); } }
protected void bt_Export_Click(object sender, EventArgs e) { string filename = HttpUtility.UrlEncode(Encoding.UTF8.GetBytes("导购投产明细导出_" + DateTime.Now.ToString("yyyyMMddHHmmss"))); int month = int.Parse(ddl_Month.SelectedValue); int organizecity = int.Parse(tr_OrganizeCity.SelectValue); DataTable dt = PM_PromotorBLL.GetAnalysisOverview(organizecity, month); if (dt.Rows.Count > 0) { dt.Columns.Remove("Promotor"); dt.Columns.Remove("ClientID"); dt.Columns.Remove("BPMID"); dt.Columns.Remove("BRTID"); dt.Columns.Remove("取消人"); dt.Columns.Remove("取消人职务"); dt.Columns.Remove("取消时间"); CreateExcel(dt, filename); } }