0

I am converting my GridView into a RadGridView and am stuck on one part. I need to be able to traverse the grid and check for checked checkboxes. I am having trouble just traversing the grid.

In my old code, I used something like

For Each myRow As GridViewRow In myGrid.Rows()

For the radGrid I have since attempted the following:

For Each myRow As GridViewRow In myGrid.MasterTableView.DataKeyValues(myGrid.SelectedIndexes)("ID")

For Each myRow As GridDataItem In myGrid.MasterTableView.DataKeyValues(myGrid.SelectedIndex)("ID")

For Each myRow As GridIndexCollection In myGrid.MasterTableView.DataKeyValues(myGrid.SelectedIndexes)("ID")

The first one had an error due to it saying that GridViewRow couldn't accept the selected value as it was attempting to be converted into an integer.

The second one had an error due to RadGrid not having SelectedIndex as a method.

The last one had an error due to it saying that it couldn't accept integers as well.

addbq2
  • 43
  • 1
  • 11
  • 1
    Try this http://stackoverflow.com/questions/11807646/get-rows-of-a-telerik-gridview-radgrid. – Calvedos Jun 06 '14 at 22:11
  • I tried something similar to that. But when I attempt to use any row value from that I get an error saying, "Reference to a non-shared member requires an object reference" and I can't seem to get it to go away unfortunately. – addbq2 Jun 09 '14 at 13:14
  • Can you post the code which gives you this error? – Calvedos Jun 09 '14 at 23:27

1 Answers1

2

The question mentioned by calvedos is correct. The vb.net equiv syntax is

For Each itm As GridItem In myGrid.MasterTableView.Items
 '.... do your work
Next

You can also use the following just to get the data items in your grid as Items will return the header, footer, etc as well.

For Each itm As GridItem In myGrid.MasterTableView.GetItems(GridItemType.Item, GridItemType.AlternatingItem)
 '.... do your work
Next
Anna Forrest
  • 1,711
  • 14
  • 21