I know how to loop through the grid view rows :
foreach (GridViewRow oItem in GridView1.Rows)
{
//
}
but what i want to do is looping through the whole gridview including the rows in the other pages if i enable the paging
.
how to do this ?
You can use
Cast<T>
orOfType<T>
to convert toIEnumerable<T>
:Or:
In this case it is correct to use both because
Rows
only contains element ofGridViewRow
. But you should not notice the different between two methods:Cast<T>
: Casts the elements to the specified type.OfType<T>
: Filters the elements based on a specified type.