You must Sign In to post a response.
  • Category: Sharepoint

    Error in Exporting Excel/PDF

    Hi,

    when i am writing code for exporting a panel to excel and PDF is not working fine.The error is coming as Control 'ctl00_m_g_75b881ee_313e_4104_9262_73eefdff6c71_ctl00_txtName' of type 'TextBox' must be placed inside a form tag with runat=server. but its working fine in webpage.


    Please help me in achieving this.

    Thanks,

    Bhanu
  • #731848
    Hi,

    While exporting the website data, a render event must occur. Add below code before Export button code in your project.

    //You have to add an another Event for Export to work properly:
    public override void VerifyRenderingInServerForm(Control control)
    {
    // Can Leave This Blank.
    }


    This can solve all problem. Even if you see the same error again, just go to the TextBox control's code and place a runat="server" tag just after
    <asp:TextBox runat="server"....../>


    - See more at: http://www.pyarb.com/2012/06/export-to-excel-from-datagridview-in.html#sthash.2sNqril6.dpuf

    Sometimes, Styles and other attributes create confusion.

    All the BEst.

    -------------
    Glad to be,
    John Bhatt
    Editor - DNS Forums
    https://www.pyarb.com


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.