GridView Must be Placed Inside a form Tag with runat=server

How to troubleshoot this following error:

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

We face regular this kind of error while we are trying to convert gridview into Excel (xls) or other file format. Even we have gridivew control inside form tag.

 

Above error image from CODE BEHIND.
 

Above error image from browser yellow page.

Solution:

Add following lines in same code behind where gridview code written.

  1. public override void VerifyRenderingInServerForm(Control control)  
  2. {  
  3.   
  4. }  

It will solved your error.

For more detail reference about this error refer following refer: