Home > Mobile >  How can I run foreach loop into filtered row in Ultra Grid?
How can I run foreach loop into filtered row in Ultra Grid?

Time:01-31

How I can run for loop only filtered rows into UltraGrid? Suppose I've a Ultra grid about 1000 rows. But I need only run loop for 5 rows which I shall get by filtering

foreach (UltraGridRow row in grdMerchandiserToBuyer.Rows)
{
}

This code fetch all rows, but I want only filtered Rows into this Grid

Please help me if anyone know that Thanks

CodePudding user response:

The UltraGrid.Rows property is of type RowsCollection, which has a method GetFilteredInNonGroupByRows. You should be able to do something like this:

foreach (UltraGridRow row in grdMerchaniserToBuyer.Rows.GetFilteredInNonGroupByRows())
{
   // your code here
}

https://www.infragistics.com/help/winforms/infragistics.win.ultrawingrid~infragistics.win.ultrawingrid.rowscollection~getfilteredinnongroupbyrows

CodePudding user response:

If you have more than 5 filtered rows, but it's required to get only first five:

foreach (UltraGridRow row in grdMerchandiserToBuyer.Rows.GetFilteredInNonGroupByRows().Take(5))
{
    ...
}
  •  Tags:  
  • Related