जगदीश खोलिया: Control 'grid 1' of type 'GridView' must be placed inside a form tag with runat=server.

Tuesday, February 12, 2013

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

Because calling GridView.RenderControl(htmlTextWriter)raises 
an exception that aserver control was rendered outside of a form.
We can avoid this exception byoverriding VerifyRenderingInServerForm
 
public override void VerifyRenderingInServerForm(Control control)
{
  /* Confirms that an HtmlForm control is rendered
     for the specified ASP.NET
     server control at run time. */
} 
 
*Note that there is nothing inside the function. 
 

No comments: