I am using the that snippet code you pointed me to in my Webform.
As for what exactly isn't working, it assume the file the user selected at
the client was uploaded to the server, and gives a general error message that
says something like the path to the file you specified doesn't exist.
I just assumed that if I read the CSV file from the Client into a Data
Table, that the Data Table reference with all it's data would have been
passed to the server, instead of trying to find the CSV file on the Server.
:
What you describe sounds like it should work.
What exactly isn't working about it?
How are you converting the CSV to DataTable?
Here is an example of what you want to do using a CSV reader 3rd party
library (there are other ways..but you asked for source code example).
http://www.csvreader.com/csv_samples.php
Note that instead of saving to the database, you would send the data
table into your class as you describe in your post.
HTH.
SAL wrote:
Currently I have a System.Web.UI.HtmlControls.HtmlInputFile control on my
Webform that allows the user to find their CSV file, and I read that CSV file
into a Data Table. I then send that Data Table in my Class back to my ASPX,
and store it in a Data View then bind my DataGrid to that Data View.
I thought this would work without uploading the file to the Server, because
I didn't want to manage these files on the Server when I was done with them.
:
You can find a file on the client's file system if you use WSH (Windows
Scripting Host). You would need to set special security on each client
browser.
Asp.Net databinding is a pure server-side functionality. You can't do it on
client.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
Hello,
Is it possible to read a CSV from the Client, and bind my Datagrid to the
data in the CSV file without uploading the file to the Server first?
I have tried and in Debug mode on my workstation it works fine, but when I
publish the page on our DEV server it doesn't fine the CSV file from the
client.
Has anyone done this before? If so, how do I do it? I'm new to ASP.net
so
if you have some sample code I can look at that would be great.
Thanks,