Hi
I've got a datagrid I want to export to excel, but do not want to display it on the webform. If I make it unvisible, it doesn't export the data in the datagrid. But if visible, it does export data. Do you know how I can still keep the datagrid unvisible, but be able to export the data?

Re: Exporting an unvisible datagrid to excel C# by Rami

Rami
Wed Feb 25 06:51:43 CST 2004

Hello,
Why do you need to use datagrid, since you don't want to show it at all? You
can export data directly from the source with which this datagrid is bound.

--
Rami Saad
Microsoft GTSC Developer support for Middle East


"Lisa" <anonymous@discussions.microsoft.com> wrote in message
news:A6403B4A-A315-41D1-B188-6F273FB46D0C@microsoft.com...
> Hi,
> I've got a datagrid I want to export to excel, but do not want to display
it on the webform. If I make it unvisible, it doesn't export the data in the
datagrid. But if visible, it does export data. Do you know how I can still
keep the datagrid unvisible, but be able to export the data?



Re: Exporting an unvisible datagrid to excel C# by anonymous

anonymous
Wed Feb 25 08:01:17 CST 2004

Hi
I'm using the RenderControl method and it doesn't want to take a source. This is how I use it
System.IO.StringWriter SW = new System.IO.StringWriter()
System.Web.UI.HtmlTextWriter HT = new System.Web.UI.HtmlTextWriter(SW)
dgExport.RenderControl(HT); // Datagrid to export to exce
Response.Write(SW.ToString())
Response.End();