This is a migrated thread and some comments may be shown as answers.

Printing controls

4 Answers 62 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Lubna Ansari
Top achievements
Rank 1
Lubna Ansari asked on 07 Jun 2010, 12:48 PM

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();

}

4 Answers, 1 is accepted

Sort by
0
Prangadj
Top achievements
Rank 1
answered on 07 Jun 2010, 01:04 PM
Telerik Rad gridview for AJAX has export feature - see here. You do not need to export on your own or call RenderControl.

Prangadj
0
Lubna Ansari
Top achievements
Rank 1
answered on 07 Jun 2010, 01:56 PM
Hi Prangadj,

Thank you for reply. But I want to export a panel where I am having controls likes datetime picker, textbox etc. I do not want ot export gridview.

Regards,
Lubna.
0
Prangadj
Top achievements
Rank 1
answered on 07 Jun 2010, 02:33 PM
I not think this is supported directly by telerik controls like date picker, textbox or so. They had property RegisterWithScriptManager that may be set to false and if you register Telerik controls client scripts and skins manually on page, you may be able to export them.

Prangadj
0
Lubna Ansari
Top achievements
Rank 1
answered on 10 Jun 2010, 09:34 AM
That is going to be so complex. Isnt there any easy way??
Tags
General Discussions
Asked by
Lubna Ansari
Top achievements
Rank 1
Answers by
Prangadj
Top achievements
Rank 1
Lubna Ansari
Top achievements
Rank 1
Share this question
or