iTextSharp to generate a gridview in pdf

前端 未结 2 1349
不知归路
不知归路 2021-01-26 12:25

I\'m trying to export a gridview to pdf with package iTextSharp.

I\'m doing it in my .aspx files :

2条回答
  •  感动是毒
    2021-01-26 12:42

    Add below code to avoid runat="server" error.

    public override void VerifyRenderingInServerForm(Control control)
    {
        /* Verifies that the control is rendered */
    }
    

    You may want to disable paging so that it exports all rows of Gridview to PDF.

    Add below code before gridview's rendercontrol method.

     gvReportingStockComp.AllowPaging = false;
     gvReportingStockComp.DataBind();
    

    Incase you've any doubt, refer below article.

    http://www.aspsnippets.com/Articles/Export-GridView-To-Word-Excel-PDF-CSV-Formats-in-ASP.Net.aspx

提交回复
热议问题