protected void btnExportProduct_Click(object sender, EventArgs e) { try { string fileName = string.Format("Exports_{0}_{1}.xls", DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"), CommonHelper.GenerateRandomDigitCode(4)); string filePath = string.Format("{0}Upload\\Product\\{1}", HttpContext.Current.Request.PhysicalApplicationPath, fileName); //产品名称 string ProductName = this.txtProductName.Text.Trim(); //厂家编码 string FactoryCode = this.txtFactoryCode.Text.Trim(); //商品编码 string ProductCode = this.txtProductCode.Text.Trim(); int BrandTypeId = this.CCBrandTypeList.SelectedValue; List <XMProduct> list = XMProductService.GetXMProducts(BrandTypeId, ProductName, FactoryCode, ProductCode); ExportManager.ExportProductExcel(filePath, list); CommonHelper.WriteResponseXls(filePath, fileName); } catch (Exception exc) { ProcessException(exc); } }