P
Phil Barber
using VS2003 the following code will send data from a datagrid to an excel
sheet:
Response.Clear();
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.ms-excel";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
DataG.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
When I try this in VS2005 (using a GridView)
I get an Error on line:
DataG.RenderControl(htmlWrite);
DataG must me be placed in a form tag with runat=server.
any ideas what must be done to get this to work?
thanks
sheet:
Response.Clear();
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.ms-excel";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
DataG.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
When I try this in VS2005 (using a GridView)
I get an Error on line:
DataG.RenderControl(htmlWrite);
DataG must me be placed in a form tag with runat=server.
any ideas what must be done to get this to work?
thanks