Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
1.00/5 (1 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
Sergey Alexandrovich Kryukov 21-Mar-12 2:14am    
What did you try so far?
--SA

1 solution

Hello

1. Use StreamReader, For example:


C#
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[^]
 
Share this answer
 
v4

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900