Hi all,
I have a grid that should only show the top 5 rows. However, the data has more than 5 rows and there maybe occasions where I need to sort the grid with all the data, but just show the top 5 rows after sorting.
Is there a feature inUltraWinGrid that would allow me to do that?
If so, could you point me to it?
Thanks.
Raymond.
This worked for me:
private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e) { if (e.Row.Index > 4) e.Row.Hidden = true; else e.Row.Hidden = false; } private void ultraGrid1_AfterSortChange(object sender, BandEventArgs e) { UltraGrid grid = (UltraGrid)e.Band.Layout.Grid; grid.Rows.Refresh(RefreshRow.FireInitializeRow); grid.ActiveRowScrollRegion.FirstRow = grid.Rows[0]; }
This works good when grid has one band. And what about child bands. How can I limit the number of rows in child bands?
I can't see why having child bands would make any difference. The row.Index would still be the same. Unless you mean you want to show only a total of 4 rows including all the parent and child rows. In that case, I'm not sure that's possible. You would need to somehow get a combined index of all the rows as if they were in one list.
A Row Index should never be -1. If that's happening then something is wrong or it may be a bug - in which case, you should Submit an incident to Infragistics Developer Support
For child bands Row.Index equal -1 when row initializing. May be I have to use other event.