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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

69457 Oct 29,2007 08:23 AM Oct 31,2007 03:03 AM Windows Forms 4
loading
Tags: GridControl
Ivaylo Fiziev
Asked On October 29, 2007 08:23 AM

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?

haneefm [Syncfusion]
Replied On October 29, 2007 06:52 PM

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

Ivaylo Fiziev
Replied On October 30, 2007 02:36 AM

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 30, 2007 08:03 PM

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


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

Thanks
This works fine

CONFIRMATION

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.

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.

;