We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to determine the index of a visible row within the grid

Hi,
I have a grid with some hidden rows.
I need a way to determine the index of a visible row by having the index of the row in the grid.
Is there an easy way to do this?

4 Replies

HA haneefm Syncfusion Team October 29, 2007 10:52 PM UTC

Hi Ivaylo,

You can use the ViewLayout.RowIndexToVisibleClient to get a visible client row index for a given absolute row index. If the row is above the top row, the client row index for the top row index is returned. If the row is below the last visible row, the client row index for the last visible row is returned. Below is the code that shows this task:

this.gridControl1.ViewLayout.RowIndexToVisibleClient( 55 );

Best regards,
Haneef


IF Ivaylo Fiziev October 30, 2007 06:36 AM UTC

Thanks for the reply.
Unfortunately this is not what I need
Maybe the term "visible" is not the most accurate one :)
I need the index of a non-hidden row relative to all non-hidden rows ...
(for example if the grid has 10 rows and rows 1,2,3,4 & 5 are hidden, then row 10 would be the 5th non-hidden row)
What I am trying to do is to determine whether a non-hidden row's index is an even or odd number.



HA haneefm Syncfusion Team October 31, 2007 12:03 AM UTC

Hi Ivaylo,

Please try these code to find the non hidden row count in a grid and let me know if this helps.

bool[] b = this.gridControl1.Model.HideRows.GetRange(1,RowIndex);
int NonHiddenRowIndex = 0;
for(int i = 0;i< b.Length;i++)
{
if(!b[i] )
NonHiddenRowIndex++;
}
Console.WriteLine(" The GridRow {0} is the {1}th NonHiddenRow of the Grid", RowIndex, NonHiddenRowIndex);

Best regards,
Haneef



IF Ivaylo Fiziev October 31, 2007 07:03 AM UTC

Thanks
This works fine

Loader.
Live Chat Icon For mobile
Up arrow icon