thia is my code
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Panel.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
p.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();
P is Panel control.
Panel control in a page and the page has a master page.
I get this error
ontrol 'MainContent_txtEmail' of type 'TextBox' must be placed inside a form tag with runat=server.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Control 'MainContent_txtEmail' of type 'TextBox' must be placed inside a form tag with runat=server.
Source Error:
Line 96: HtmlTextWriter hw = new HtmlTextWriter(sw);
Line 97:
Line 98: p.RenderControl(hw);
Line 99: StringReader sr = new StringReader(sw.ToString());
Line 100: Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
please help me to solve this
thaks