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.
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
}
}
PS Please read the Traversing Rows article for details.
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.
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);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.