Solved

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

Posted on 2014-01-14
1
1,419 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

12 Experts available now in Live!

Get 1:1 Help Now