使用Ajax Tab Container将asp.net网页转换为pdf

时间:2021-06-17 21:08:51

I am creating an website which have too much data import and exports,users all data are displayed in ajax tab container,my problem is that when i am try to export those data in PDF it displays following error:

我正在创建一个有太多数据导入和导出的网站,用户所有数据都显示在ajax选项卡容器中,我的问题是,当我尝试以PDF格式导出这些数据时,它显示以下错误:

Script control 'TabPanel1' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().

Parameter name: scriptControl

参数名称:scriptControl

i am using iTextSharp dll library for Exports all data which contain in tab panels in pdf on code side i declare all name spaces :

我正在使用iTextSharp dll库导出包含在代码端pdf的选项卡面板中的所有数据我声明所有名称空间:

using System.IO;
using System.Collections.Generic;
using System.Text;
using iTextSharp.text;
using iTextSharp.text.html.simpleparser;
using iTextSharp.text.pdf;

and set an code for export page into pdf :

并将导出页面的代码设置为pdf:

 protected void pdf_Click(object sender, EventArgs e)
    {
        Response.ContentType = "application/pdf";
        Response.AddHeader("content-disposition", "attachment;filename=TestPage.pdf");
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        StringWriter sw = new StringWriter();
        HtmlTextWriter hw = new HtmlTextWriter(sw);

        this.Page.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();
    }

But it displays above error, can anyone can help me:

但它显示错误,任何人都可以帮助我:

1 个解决方案

#1


0  

Set the registerWithScriptManager property of your control to false (registerWithScriptManager="false")

将控件的registerWithScriptManager属性设置为false(registerWithScriptManager =“false”)

you will probably have to type it in, there usually isn't a spot for it in the properties pane.

您可能需要输入它,在属性窗格中通常没有它的位置。

#1


0  

Set the registerWithScriptManager property of your control to false (registerWithScriptManager="false")

将控件的registerWithScriptManager属性设置为false(registerWithScriptManager =“false”)

you will probably have to type it in, there usually isn't a spot for it in the properties pane.

您可能需要输入它,在属性窗格中通常没有它的位置。