Getting a handle on filtered rows in DataGrid

G

Guest

I have a DataGrid sourced by a DataView of a DataTable, and I would like to
output the results of any RowFilter operations to a text file. I thought this
would be easy but I cannot find where to obtain all the filtered rows? If I
reference the tables rows I get every single record, and the DataView object
does not seem to have anything like a Rows property...
 
N

Nicholas Paldino [.NET/C# MVP]

MrNobody,

The indexer for the DataView will give you the DataRowView instances
that correspond to the rows that are filtered on. I believe you can cycle
through the DataView with a foreach statement to get the filtered rows.

Hope this helps.
 
G

Guest

Ah! Silly me- totally overlooked that- thanks!

Now if I wanted to know what columns are visible, I'd have to iterate
through the DataGridColumnStyles right? Can't do that through this
DataRowView or the DataView itself?
 
N

Nicholas Paldino [.NET/C# MVP]

MrNobody,

You are right. There is no link between the DataView/DataTable and the
presentation, it just contains the data (thank God).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top