Hi,
I am exporting controls of asp panel using the following code. This code works well asp.net controls but when I use same panel having telerik controls it gives me error "The control with ID 'txtEmail' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it." on RenderControl line.
protected
void ExportGridView()
{
Response.Clear();
Response.AddHeader(
"content-disposition", "attachment;filename= Report.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);
Page pg = new Page();
pg.EnableEventValidation =
false;
pg.DesignerInitialize();
HtmlForm frm = new HtmlForm();
pg.Controls.Add(frm);
frm.Attributes.Add(
"runat", "server");
frm.Controls.Add(pnlUser); // Adding panel to form
frm.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}