简体   繁体   English

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

[英]convert an asp.net webpage to pdf With Ajax Tab Container

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: 但它显示以上错误,任何人都可以帮助我:

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. 您可能必须输入它,通常在属性窗格中没有它的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM