Reading all the rows of a datagrid that is using paging...

B

Bob Morvay

This should be simple but I am stuck. I am trying to read all the rows of
my datagrid across all the pages. I can read all the rows on the page that
I am on but I can't seem to figure out how to iterate through all the pages.
Can anyone lend some insight. Here is the basic code that I am using to
attempt to read all the rows...

Private Sub btnUpdate(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnUpdate.Click
Dim item As DataGridItem
For Each item In DataGrid1.Items
ID = Convert.ToInt32(DataGrid1.DataKeys(item.ItemIndex))
UpdateTable()
Next
End Sub

My example datagrid has 3 pages. This code will only update the database
with the items on the page that I am on when I click the update button. I
need it to iterate through all the pages of the datagrid for all the items.

Thanks in advance.
 
B

Bob Morvay

I figured it out. I had to set the currentpageindex of the datagrid, rebind
my data and I can iterate through all the pages via the datagrid pagecount.
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top