hi
although it can be easier to have code-behind, to my knowledge you can
achieve the same things with inline code. so don't worry about that.
this code below will render a datagrid into a string, which is a valid excel
document.
// get the text of the rendered datagrid
string datagridText;
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter htw = new HtmlTextWriter(sw))
{
// instantiate a datagrid
grdResults.RenderControl(htw);
datagridText = sw.ToString();
}
}
if you want a CSV format, you can adapt the code from this article:
http://tim.mackey.ie/PermaLink.aspx?...d-7e3ee82af55f
and instead of sending the CSV string to the HttpResponse, write it to a
file.
hope this helps
tim
--------------------------
blog:
http://tim.mackey.ie
<fo**********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I have a page with a datagrid that I have configured with all the
information I need to provide to froogle for listing my products on
their site. I am having trouble finding a way to successfully save the
data in this datagrid as a text file.
I am somewhat limited in that I do _NOT_ have access to code-behind.
All code I use must be inline on the ASPX and the ASCX pages. I can
create new pages if that would help.
Does anyone know of a way to export the data using only inline code on
this page? The datagrid has an id="grdResults". The code does not need
to download the text file, just save it to a folder on the site. I can
download it later.
If any of you have solutions or suggestions I would be very grateful!
Thanks,
five40