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

Looping through Selected Rows

1 Answer 226 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Judy
Top achievements
Rank 1
Judy asked on 15 May 2008, 09:49 PM

I'm in the process of resolving the issues created by upgrading to Q1 2008 for all of my instances of the RadGridView control.  In Q3 2007, I was able to loop through the selected rows and add the value of a specific cell to a generic list by doing the following:

Dim mPartNumberList As New List(Of String)
Dim selectedRows As List(Of GridViewRowInfo) = PartListRadGridView.SelectedRows

For Each row As GridViewRowInfo In selectedRows
     mPartNumberList.Add(Convert.ToInt32(row.Cells(1).Value))
Next

This now fails.  What is the equivalent in Q1 2008?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 17 May 2008, 01:10 PM
Hi Judy,

In Q1 2008, RadGridView implements GridViewSelectedRowsCollection which you can use to get the SelectedRows collection:
 
Dim mPartNumberList As New List(Of String)()   
Dim selectedRows As GridViewSelectedRowsCollection = radGridView1.SelectedRows   
For Each row As GridViewRowInfo In selectedRows   
    mPartNumberList.Add(row.Cells(0).Value.ToString())   
Next 

In addition, I notice that your mPartNumberList is of type string, but you try to add values of type int. This is not supported: Either change the type of your generic collection to int, or add values of the collection type string.

If you have additional questions, do not hesitate to contact me.
 

All the best,
Nikolay
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Judy
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or