views:

343

answers:

2

I have a paged gridview. I want to get the text of every row and put that text into an array. However, I only get the text for the visible rows, not the entire dataset. I can't just get the data from the datasource because the gridview is populated by two different databases. How could I get every row's text - visible or not visible? I'm trying to put the text in an array as follows:

Protected Sub GridView1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.Load
    For j As Integer = 0 To GridView1.Rows.Count - 1
        If GridView1.Rows(j).Cells(3).Text = "Yes" Then
            loginoper = loginoper & GridView1.Rows(j).Cells(1).Text & ","

        Else
            logoutoper = logoutoper & GridView1.Rows(j).Cells(1).Text & ","

        End If
    Next
End Sub
A: 

I don't think, you can iterate all rows including invisble rows, becoz when gridview data posted to the server, gridview contain only visible rows..... You have to iterate dataset... I think......

Muhammad Akhtar
A: 

You can do processing against every row of a GridView in the RowDataBound event. First, you'll have to check the .Row.RowType property of the passed-in GridViewRowEventArgs -- it'll be Header, DataRow, Footer, etc. Then, if it is a DataRow, add it's data to your array with whatever additional logic you need.