Printing controls

5 posts, 0 answers
  1. Lubna Ansari
    Lubna Ansari avatar
    65 posts
    Member since:
    Feb 2010

    Posted 07 Jun 2010 Link to this post

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

    }

  2. Prangadj
    Prangadj avatar
    174 posts
    Member since:
    Jan 2008

    Posted 07 Jun 2010 Link to this post

    Telerik Rad gridview for AJAX has export feature - see here. You do not need to export on your own or call RenderControl.

    Prangadj
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lubna Ansari
    Lubna Ansari avatar
    65 posts
    Member since:
    Feb 2010

    Posted 07 Jun 2010 Link to this post

    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.
  5. Prangadj
    Prangadj avatar
    174 posts
    Member since:
    Jan 2008

    Posted 07 Jun 2010 Link to this post

    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
  6. Lubna Ansari
    Lubna Ansari avatar
    65 posts
    Member since:
    Feb 2010

    Posted 10 Jun 2010 Link to this post

    That is going to be so complex. Isnt there any easy way??
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017