public void exportar()
        {
            DateTime FechaFinal = Convert.ToDateTime(TxtFecFin.Value, new CultureInfo("es-ES"));

            FechaFinal = FechaFinal.AddDays(1);
            string FechaSalida = FechaFinal.ToString("dd/MM/yyyy");

            GvExport.DataSource = obj.ListarPedido(TxtFechaInicio.Value.ToString(), FechaSalida.ToString(), DDUsuario.SelectedValue.ToString().Trim());
            GvExport.DataBind();
            lblNombre.Text = "CONTROL VENTA DE PEDIDO";
            LblFecha.Text  = "FECHA:  " + DateTime.Now.ToString("dd/MM/yyyy");

            Response.Clear();
            Response.AddHeader("content-disposition", "attachment;filename=Pedido.xls");
            Response.Charset     = "";
            Response.ContentType = "application/vnd.ms-excel";
            System.IO.StringWriter       stringWrite = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter htmlWrite   = new HtmlTextWriter(stringWrite);
            PanelExportarExcel.RenderControl(htmlWrite);
            Response.Write(stringWrite.ToString());
            Response.End();


            //Response.Clear();
            //Response.AddHeader("content-disposition", "attachment; filename = Pedido.xls");
            //Response.ContentType = "application/vnd.xls";
            //System.IO.StringWriter stringWrite = new System.IO.StringWriter();
            //System.Web.UI.HtmlTextWriter htmlWrite =
            //new HtmlTextWriter(stringWrite);
            //GvExport.RenderControl(htmlWrite);
            //Response.Write(stringWrite.ToString());
            //Response.End();
        }
        public void exportar()
        {
            GvExport.DataSource = obj.ReporteVendedorDistribuidor(TxtFechaInicio.Value.ToString(), DDUsuario.SelectedValue.ToString().Trim());
            GvExport.DataBind();
            lblNombre.Text = "REPORTE VENTA POR VENDEDOR";
            LblFecha.Text  = "FECHA:  " + DateTime.Now.ToString("dd/MM/yyyy");

            Response.Clear();
            Response.AddHeader("content-disposition", "attachment;filename=ReporteVendedor.xls");
            Response.Charset     = "";
            Response.ContentType = "application/vnd.ms-excel";
            System.IO.StringWriter       stringWrite = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter htmlWrite   = new HtmlTextWriter(stringWrite);
            PanelExportarExcel.RenderControl(htmlWrite);
            Response.Write(stringWrite.ToString());
            Response.End();


            //Response.Clear();
            //Response.AddHeader("content-disposition", "attachment; filename = ReporteVendedor.xls");
            //Response.ContentType = "application/vnd.xls";
            //System.IO.StringWriter stringWrite = new System.IO.StringWriter();
            //System.Web.UI.HtmlTextWriter htmlWrite =
            //new HtmlTextWriter(stringWrite);
            //GvExport.RenderControl(htmlWrite);
            //Response.Write(stringWrite.ToString());
            //Response.End();
        }