473,405 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

GridView and parsing

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

Nov 13 '06 #1
1 1167
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...VIntoGrid.aspx

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
<px*****@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
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

Nov 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the...
6
by: Nalaka | last post by:
Hi, I have a gridView (grid1), which as a templateColumn. In the template column, I have put in a gridView (grid2) and a ObjectDataSource (objectDataSource2). Question is... How to I pass the...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
5
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens...
1
by: Sukh | last post by:
I'm new to ASP.NET 2. In the prev. version i was able to do a lot of parsing and other changes in the Item_DataBound Method of DataGrid, and I wasn't able to find its equivalent with GridView. Am i...
4
by: Tom | last post by:
I have a gridview on all of my web pages in my web app and they all export to excel. I have one page where the gridview is binding to a datatable that i created and only the first column is...
2
by: antonyliu2002 | last post by:
I've been googling for some time, and could not find the solution to this problem. I am testing the paging feature of gridview. I have a very simple web form on which the user can select a few...
6
by: RobertTheProgrammer | last post by:
Hi folks, Here's a weird problem... I have a nested GridView setup (i.e. a GridView within a GridView), and within the nested GridView I have a DropDownList item which has the...
3
by: Peter | last post by:
I have a GridView which is populated by List<ofObjects> Does anyone have example of how to sort the columns of this GridView? I have found examples without DataSourceControl but these use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.