Monday, July 9, 2007

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

CodeSnip: Exporting GridView to Excel: ASP Alliance

This is pretty confusing, since your GridView is already inside the form tags and also contains the runat = server attribute. You can easily resolve this error by adding the following lines.

Listing 3: Overiding VerifyRenderingInServerForm Method
public override void VerifyRenderingInServerForm(Control control)
{
/* Confirms that an HtmlForm control is rendered for the specified ASP.NET
server control at run time. */
}


www.svdeals.com super hot deals

No comments: