Yes, my GridView1 is now with the data, but when I try to export the GridView SqlDataSource has a ControlParameter called Drop_Ejecutivo, but when I try to send it to hw, make the following error
There are also several controls Chart Type, which I have to export to PDF, but when I try it gives me an error:
Invalid characters in the path.
Could not find control 'Drop_Ejecutivo' in ControlParameter 'Ejecutivo_'.
Here is my code
protected void Button1_Click(object sender, EventArgs e)
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Panel.pdf");
HtmlForm form_nuevo = new HtmlForm();
form_nuevo.Attributes.Add("RunAt", "Server");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
form_nuevo.Controls.Add(GridView1);
form_nuevo.Controls.Add(GridView4);
form_nuevo.Controls.Add(Drop_Ejecutivo);
form_nuevo.Controls.Add(Mes_de_Cierre);
Panel1.RenderControl(hw);
GridView1.RenderControl(hw);
Drop_Ejecutivo.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
}