473,387 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 1447
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.