Wednesday, 26 June 2013

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

As I thought, your code behind confirmed it that you indeed are exporting your grid.

The above exception occurs when one tries to export a GridView control to Word, Excel, PDF, CSV or any other formats. Here the .net compiler thinks that the control is not added to the form and is rendered, hence it throws this error even if your GridView control is inside a form with runat = “server”.

You have to tell the compiler that the control is rendered explicitly by overriding the VerifyRenderingInServerForm event.


    public override void VerifyRenderingInServerForm(Control control)
    {
        //
    }

This will confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time

No comments:

Post a Comment

KendoUI Chart using in AngularJS with Dynamic data

Here i'm going to do the KendoUI Chart using AngularJS  and getting dynamic data from angular services. First need to down-lode the r...