472,986 Members | 3,017 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,986 software developers and data experts.

Export Datagrid to text file for froogle feed

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

Nov 19 '05 #1
2 1425
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

Nov 19 '05 #2
I've listed the steps to export a datagrid to Excel here:
http://SteveOrr.net/Articles/ExcelExport.aspx
It also includes other exporting techniques.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
<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

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Shawn Mehaffie | last post by:
I have the following class that I've wirtten to take a Dataset and automatically export it to either XML, ASCII or Tab delimited file. The reason I wrote it they way I did was that I don't want to...
0
by: Shawn Mehaffie | last post by:
I have the following class that I've wirtten to take a Dataset and automatically export it to either XML, ASCII or Tab delimited file. The reason I wrote it they way I did was that I don't want to...
0
by: Shawn Mehaffie | last post by:
I have the following class that I've wirtten to take a Dataset and automatically export it to either XML, ASCII or Tab delimited file. The reason I wrote it they way I did was that I don't want to...
0
by: Shawn Mehaffie | last post by:
I have the following class that I've wirtten to take a Dataset and automatically export it to either XML, ASCII or Tab delimited file. The reason I wrote it they way I did was that I don't want to...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.