GridView and parsing

P

pxpilot

Hi All,
I am new to ASP.NET plaese help.
I am parsing a very big data txt file, the file is made of rows each
has 4 values delimited with a tab.
I would like to push each value into it's own cell in a grid row by row
the loop below inserts only the last row....any ideas

Do While fileReader.Peek >= 0 And CurrentPercent <
Request("PercentToLoad")
i = i + 1
stringReader = fileReader.ReadLine()
CurrentCountOfChars = CurrentCountOfChars +
stringReader.Length
CurrentPercent = Math.Round((CurrentCountOfChars /
CountOfChars) * 100, 4)
GridView1.DataSource = stringReader.Split(" ")
GridView1.DataBind()
Loop
 
J

John Timney \(MVP\)

All your binding to is the last line of your file because your binding to
the array returned from split - which only contains the current (or last)
line being read.

You'll need to take your readlines into a collection of values that can be
bound. Either manually create a datatable and bind to that or treat it like
some form of CSV and bind that way.
http://www.netomatix.com/development/ImportCSVIntoGrid.aspx

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top