GridView control "must be placed inside a form tag with runat=server"
I tried to follow up Ram's suggestion and exported data in a GridView to a word documents by following code snippet:
代码
After building the project and try to view it in browser, however, the browser just told me the following message when clicking the Export data button:
After a quick search, I found: http://rstew.blogspot.com/2007/10/gridview-must-be-placed-inside-form-tag.html, great post, override the VerifyRenderingInServerForm method, the process works happily!
public override void VerifyRenderingInServerForm(Control control)
{
return;
}