Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 13th, 2006, 01:03 AM
Authorized User
 
Join Date: Nov 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Classic ASP - how to export data from modal window

Hi there

I have this modal dialog window that shows the first 5 rows of a record set.

There is an Export ALL button so the user doesn't have to scroll through each page to see the result but can just export to a comma-delimited file. The file is .txt (not .csv not .xsl) that just looks as simple as:

LastName,FirstName,EmployeeId
McDonald,Robert,E0001
Wong,Denny,E0002

I thought it is an easy thing, but it feels like it is COMPLETELY IMPOSSIBLE!!

I have no idea how to do that. I'm on a modal window so if I do a <form> and post the action to itself, then a new blank window comes up. But if I don't do a post, I don't know how I can hit this button and then the server can run the data retrieval and send the result back to the client....

All I want to do is that, as soon as the user hits this button, there will be a File SaveAs dialog box comes up that lets the user decide the name and the location, and then the txt file gets downloaded there. NOTE: since the grid shows only the first five rows, I have to call my data retreival process (stored proc in this case) to specify retrieving all rows, so some data exported is not currently in the grid.

Can you suggest how I should go proceed?

Thanks a lot
CC
 
Old November 14th, 2006, 09:11 AM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 114
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Surely if you want the record save by the user then you need to be doing this client-side, rather than server-side. If this is the case tne you would be looking to use javascript to create the file and write the data...

var fs, f;
fs = new ActiveXObject("Scripting.FileSystemObject");
f = fs.CreateTextFile("c:\test.txt");
f.WriteLine ("Hello World");
f = null;
fs = null;

Not going to swear on the above code for writing a file as I haven't tested it, but it should be fine.

Regards,

Sean Anderson





Similar Threads
Thread Thread Starter Forum Replies Last Post
CSV files export with Classic ASP, special chars tn_bobbie Classic ASP Basics 1 July 9th, 2015 08:12 AM
Passing data from modal dialog to window. ganga Javascript 1 September 26th, 2006 06:45 AM
Modal Window... babloo81 Javascript 2 February 21st, 2005 07:08 AM
modal window pablens Classic ASP Professional 3 December 28th, 2004 05:28 PM
Modal dialog window eldanh ASP.NET 1.0 and 1.1 Basics 0 August 10th, 2004 02:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.