Reputation: 159
I have a gridList in my c# project. There is more than 100 000 records in my gridList. I want to do some operation on filtered rows. For example I filtered gridList by 'name' column ,then I want to select all filtered rows. How can I do this?
Thank you for your help.
Upvotes: 1
Views: 4449
Reputation: 159
I find another answer for tihs problem:
void TraverseRows(ColumnView view,bool selectRemove)
{
dtTemp = new Data.Medical.Follow.DSFollow.FollowRequestsDataTable();
for (int i = 0; i < gridViewList.RowCount; i++)
{
DataRow row = gridViewList.GetDataRow(gridViewList.GetVisibleRowHandle(i));
row["is_selected"] = selectRemove;
dtTemp.AddFollowRequestsRow((DSFollow.FollowRequestsRow)row);
}
}
Upvotes: 0
Reputation: 17848
To traverse grid rows (with grouping, sorting and filtering taking into account) use the following approach:
void TraverseRows(ColumnView view) {
for (int i = 0; i < view.DataRowCount; i++) {
object row = view.GetRow(i);
// do something with row
}
}
P.S. Please read the Traversing Rows article for details.
Upvotes: 2
Reputation: 26886
First you need to set OptionsSelection.MultiSelect = true
property of your GridView
.
Then, to select all filtered rows you can use SelectAll()
method of your GridView
after applying your filter.
Upvotes: 1