private void LogisticaStockMinListarPL() { try { GLogisticaStockMin.DataSource = LogisticaStockMinNego.LogisticaStockMinListarCDatos(txtFecha1.Text, txtFecha2.Text, ddlList.Text); GLogisticaStockMin.DataBind(); } catch (SqlException ex) { throw new Exception(ex.Message); } }
protected void Button2_Click(object sender, EventArgs e) { Response.Clear(); Response.Buffer = true; Response.ClearContent(); Response.ClearHeaders(); Response.Charset = ""; string FileName = "StockMinimo" + DateTime.Now + ".xls"; StringWriter strwritter = new StringWriter(); HtmlTextWriter htmltextwrtter = new HtmlTextWriter(strwritter); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName); GLogisticaStockMin.GridLines = GridLines.Both; GLogisticaStockMin.HeaderStyle.Font.Bold = true; GLogisticaStockMin.RenderControl(htmltextwrtter); Response.Write(strwritter.ToString()); Response.End(); }