Click here to Skip to main content
14,573,590 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have some data in a text file. How to read those lines of data and I want display those data into GridView.
Posted
Updated 20-Mar-12 20:21pm
v2
Comments
   
What did you try so far?
--SA

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Hello

1. Use StreamReader, For example:


string path = "C:\\Test.TXT";


System.IO.StreamReader stream = new System.IO.StreamReader(path);


List<string> lineList = new List<string>();
while (!stream.EndOfStream)
{
    lineList.Add(stream.ReadLine());
}


2. Bind the lineList to your GridView.
How? Look at this: http://www.dotnetspider.com/resources/22543-BINDING-List-TO-GridView.aspx[^]
   
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100