Jeffri Alfred Jeffri Alfred - 1 month ago 11
ASP.NET (C#) Question

Export gridview to pdf asp.net c# web form

I have some problems to export gridview to pdf.

First , it shows error message


Control 'ContentPlaceHolder1_GVAttendance' of type 'GridView' must be placed inside a form tag with runat=server.


and then I tried to googling and find these codes,

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


but it show error message again


Error 5 'My.Project.Control' is a 'namespace' but is used like a 'type'


How can i fix it?

Answer

Try Replacing the above code like this

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

Hope this works.