"Downloading" datagrids

G

Guest

Hi all,

I have developed a pretty straightforward web app which displays the results
of a query in a datagrid.

I want to provide a "Download as csv" link, but want to generate this
without having to requery the database.

What's the best way to persist the underlying datatable? It's running on an
intranet and even then not that often. The datatable is around 1000 rows.

Current ideas include passing in viewstate, storing in session or generating
a temp file to serve. What are the pros and cons, and if possible
implementation tips?

Spammy
 
G

Guest

For an intranet solution maybe ViewState is the better approach, as it passes
the data "through the wire".
The session variables reside in the memory and are better approach when
connection overheat is to be avoided.
I would recommend using ViewState!

Hope that helps!
Regards,
Kostadin Kostov
 
E

Ersin Gençtürk

If performance is not critacal for your application you can generate cvs
file using guid filenames each time you generate datagrid.So you only need
to put a link to that generated cvs file.However , you have to write some
delete code in the session_end to delete unnecessary generated cvs files.
 
G

Guest

Just taught you might be interested in this;
Infragistics WebGrid control comes with a ExcelExportor.
One line of code with export all data in the grid, even if your using pages,
to the clients PC. It pops up the save as dialog for them.
Real basic, drop the grid on page and the exportor and a btn/btnlink.
Under the btn put the one line of code and your done. Works great :)

Also note for the webgrid make sure you use pages and set page to have no
more then 200 rows at a time. Else speed gets hit real bad.

Also sense your in a intranet take a look at SmartClients. Using their
wingrid here is just awesome. Built in filters, sorting and a few
calculation summarys.

Ok will stop rant now :). It is good though. :)

Deasun
http://www.tirnaog.com
 
G

Guest

That sounds ideal I guess. I'm not too sure how sessions work though - when
would they expire? I mean suppose the user is reading the onscreen report
(which takes 30 mins), would the csv still be available, or would the
session end code fire?

Viewstate is still an option. I havn't heard anything against using a
session variable though...

Spammy
 
E

Ersin Gençtürk

you can adjust your application's session time out in your web.config
file.If you want you can adjust it for 30 mins.
 
E

Elton Wang

Suppose a user keeps browser open and does something else,
after a half hour then click file link. Since the file was
deleted, an error will come out. How to you think this
situation?

Elton Wang
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top