Solved

using C# How to Import Data from a asp.net GridView to a CSV File

Posted on 2014-01-14
1
1,425 Views
Last Modified: 2014-05-07
Can you import data from a CSV file and insert it into a ASP.NET GridView?  If so, can you provide a code example.

My code that I have so far: (which does not work):
 //CSV file input
        if (radDataInputFormat.SelectedValue == "3") -- I am allowing the user to select which data format that they want to use to insert/import data into the grid - this is for CSV
        {
            if (System.IO.File.Exists(fileUploadSI.FileName.ToString()))
            {
                System.IO.StreamReader fileReader = new StreamReader(fileUploadSI.FileName);

                //Check the end of file's content
                if (fileReader.Peek() != -1)
                {
                    string fileRow = fileReader.ReadLine();
                    string[] fileDateField = fileRow.Split(',');
                }
                //Close the StreamReader
                fileReader.Close();
            }
        }

Open in new window

0
Comment
Question by:newjeep19
1 Comment
 
LVL 16

Accepted Solution

by:
Stephan earned 500 total points
ID: 39781426
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Json and asp.net mvc 2 44
Windows 10 IIS and Windows Authentication to SQL 21 53
Error in page 3 45
Name space syntax error 12 41
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now