hi,
i am using master page and child pages in the child page
i want to export the gridview data to excel sheet for this i use the following code
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment; filename=shedules.xls");
Response.ContentType = "application/excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
grdshedules.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
but in the
gridShedules.RenderControl(htw) i got the following error but the form
tag with runat= server is already in the master page how to solve this
issue
error:Control 'ctl00_ContentPlaceHolder1_grdshedules' of type 'GridView' must be placed inside a form tag with runat=server.
Suthish NairPosted Oct 7, 2010, 5:03 PM
VerifyRenderingInServerForm: Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time
more discussion: http://forums.asp.net/p/1086952/1625783.aspx