Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filtering a dataview

Status
Not open for further replies.

logi2000

Programmer
Jun 17, 2003
221
CR
how do i properly set a data view filtering?

i have a dataview, apply the setrow filter, but when i check the rows in the data view, it has all the columns, and not only the filtered ones.

any examples ?
 
How are you checking the rows. Its been a little time since I used a DataView but I think if you check the ros using
Code:
foreach(DataRow row in view.Rows){
//do something with row
}
This will enumerate all the rows in the table you are viewing whereas if you use
Code:
foreach(DataRowView rowView in view){
//do something with rowView.Row
}
Then you will get only the filtered rows. Hopefully I got this right ;-)

Rob

i'm a boy, called Bert, and I may not be crazy, but if i'm not the rest of you are...
 
i use the row count prperty of the data view,
but it seems the filtering is not being correcty applied
 
I think this because the DataView has all the rows in the DataTable in it regardless of the filter. It is only when you enumerate the DataRowView collection that you have access to the filtered rows only.

Rob

i'm a boy, called Bert, and I may not be crazy, but if i'm not the rest of you are...
 
the filtering is done correctly, but i cant put the results into a data table, so i do it into a datagrid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top