Now it's time to implement such a feature in the DevExpress GridView. is to determine whether the current selected row is a grouped row, and if so, to get all the data information under that grouping.
such as (the group in the Red Box is selected to act.) Program to get all the data under the group)
The implementation code is as follows:
list<int> _gridviewrowindexs = new list<int> (); Stores the selected row index in the GridView private void Test () {int[] rows = gridview1.getselectedrows ();//Get GridView The selected data row information for (int i = 0; i < rows. Count (); i++) _gridviewrowindexs = Fildrowsnotgroupindex (Rows[i]); }//Gets all data row indexes under grouping (for cases with multilevel groupings) private list<int> fildrowsnotgroupindex (int rowIndex) { List<int> returnvalue = new list<int> (); BOOL IsGroup = Gridview1.isgrouprow (RowIndex);//Determines whether the current row index is a grouped row if (IsGroup = = False) { Returnvalue.add (RowIndex); } else {int count = Gridview1.getchildrowcount (rowIndex);//Gets the number of data under the current grouping for (int j = 0; J < Count; J + +) {int childrowindex = Gridview1.getchildrowhandle ( RowIndex, j);//Gets the row index of the record Returnvalue.addrange under the current grouping (fildrowsnotGroupindex (Childrowindex). ToArray ()); }} return returnvalue; }
Gets the row index _gridviewrowindexs is the row index in the GridView. If you want to get the row index of the bound data source.
int datatableindex = Gridview1.getdatasourcerowindex (item); Converts a row index in a GridView to a row index in a bound data source
Dev GridView gets all data rows under the selected group Z