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

Gridview Unfiltered Rows

3 Answers 102 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Heath Aldrich
Top achievements
Rank 2
Heath Aldrich asked on 23 Feb 2011, 11:53 PM
Hello, 
I have looked and see that some people report that the isvisible property is true or false depending on whether the row is filtered.
I don't find this in my project.

I have a gridview that is bound to a datatable.
When the user filters the rows, we want to be able to iterate over the unfiltered rows and update a value in a cell.

Whenever I iterate over the gridview.rows collection, the gridviewrowinfo.isvisible is always true, regardless of filter state.

Can anyone point me to what I'm doing wrong?

Here is a snipit of code
Dim mCellPos As Integer = rgvItemsAndProps.CurrentCell.ColumnIndex
            rgvItemsAndProps.BeginEdit()
            For Each gr As GridViewRowInfo In rgvItemsAndProps.Rows
                Dim y As String = gr.Cells(2).Value
                If gr.IsVisible = True Then
                    gr.Cells(mCellPos).Value = _ItemPropGridClipboard
                End If
            Next
            rgvItemsAndProps.EndEdit()
        End If



3 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 24 Feb 2011, 12:02 AM
Hello,

Once you have filtered your rows, you just need to loop over the ChildRows collection, not the Rows collection. The ChildRows collection will give you all the rows that are visible in the grid at that time.

For Each row As GridViewRowInfo In Me.radGridView1.ChildRows
    MessageBox.Show(row.Cells("Name").Value.ToString())
Next

hope that helps
Richard
0
Heath Aldrich
Top achievements
Rank 2
answered on 24 Feb 2011, 12:04 AM
Thanks much... that was exactly my problem.
0
Richard Slade
Top achievements
Rank 2
answered on 24 Feb 2011, 12:11 AM
you're welcome Heath. Please remember to mark as answer and if you need anyhting further, just let me know
Richard
Tags
GridView
Asked by
Heath Aldrich
Top achievements
Rank 2
Answers by
Richard Slade
Top achievements
Rank 2
Heath Aldrich
Top achievements
Rank 2
Share this question
or