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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:





69457 Oct 29,2007 12:23 PM UTC Oct 31,2007 07:03 AM UTC WinForms 4
Tags: GridControl
Ivaylo Fiziev
Asked On October 29, 2007 12:23 PM UTC

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?

haneefm [Syncfusion]
Replied On 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,

Ivaylo Fiziev
Replied On 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.

haneefm [Syncfusion]
Replied On 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] )
Console.WriteLine(" The GridRow {0} is the {1}th NonHiddenRow of the Grid", RowIndex, NonHiddenRowIndex);

Best regards,

Ivaylo Fiziev
Replied On October 31, 2007 07:03 AM UTC

This works fine


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon