Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all,

When i go to print, I am getting this error -
C#
Control 'gvItemUpdate' of type 'GridView' must be placed inside a form tag with runat=server.

How can i solve it.
Posted
Updated 6-Jun-12 18:33pm
v2
Comments
hitech_s 7-Jun-12 1:16am    
please post your design code then we will catchout the mistake

VB
The error tells that you probably either misplaced your control in aspx (outside of form element) or that  as<b></b>px form element does not have runat="server"
 
Share this answer
 
Control 'gvItemUpdate' of type 'GridView' must be placed inside a form tag with runat=server
The above exception occurs when one tries to export a GridView control to Word, Excel, PDF, CSV or any other formats.

Reason:
.NET compiler thinks that the control is not added to the form and is rendered.

Solution:
Tell compiler that the control is rendered explicitly by overriding the VerifyRenderingInServerForm event.
Something like:
C#
public override void VerifyRenderingInServerForm(Control control)
{
    /* Verifies that the control is rendered */
}

This Error/issue reported & resolution suggested by MS here: RenderControl doesn't work for GridView[^]
 
Share this answer
 
may be your gridview is misplaced please keep in ur code runat="server" or check once your code inside tag r not
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900