This is a migrated thread and some comments may be shown as answers.

Looping through all rows, not just rows currently displayed

2 Answers 474 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Danny
Top achievements
Rank 1
Danny asked on 19 Jul 2011, 12:56 PM
Hi,

I wish to loop through all rows in a RadGrid, not just the ones that are currently displayed, to extract the value of a cell. I am using the following code:
For Each item As GridDataItem In RadGrid1.Items
          Response.Write("Custid=" & item("custid").Text & "<BR>")
Next

This works fine but only for the currently displayed items. I wish to do this for all items in RadGrid, not just the ones that are displayed.

Thanks

Tim

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 20 Jul 2011, 05:25 AM
Hello Timmy,

If you have enabled paging in your grid, then one option to achieve this is, to disable paging and Rebind the grid. After looping through each grid item again enable paging and Rebind the grid.

C#:
RadGrid1.AllowPaging = False
RadGrid1.Rebind()
For Each item As GridDataItem In RadGrid1.Items
          Response.Write("Custid=" & item("custid").Text & "<BR>")
Next
RadGrid1.AllowPaging = True
RadGrid1.Rebind()

Thanks,
Shinu.
0
Danny
Top achievements
Rank 1
answered on 20 Jul 2011, 02:31 PM
Shinu,

Thanks for that, worked a treat.

Tim
Tags
Grid
Asked by
Danny
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Danny
Top achievements
Rank 1
Share this question
or