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.

Hiding rows in a Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

59492 Apr 14,2007 07:52 AM Apr 16,2007 06:26 PM Windows Forms 1
loading
Tags: GridControl
Praveen
Asked On April 14, 2007 07:52 AM

Sir/Madam

How can I hide rows in a grid with out any changes in the grid format, I mean the row styles odd and even colors must not be altered.

I have used the following statement to hide rows:

myDataBoundGrid.Model.HideRows[specificRow] = true;

But the odd and even colors of the rows are not mixing.

So, is any one there to supply me a sample code to hide rows in a grid with out disturbing row format.

haneefm [Syncfusion]
Replied On April 16, 2007 06:26 PM

Hi Praveen,

Here is a little sample that shows you "How to format the alternate rows in a grid using the PrepareViewStyleInfo event.
GDBGAlternateRows.zip

[c#]
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if( e.RowIndex > 0 )
{
GridDataBoundGrid _grid = sender as GridDataBoundGrid;
if( ! _grid.Model.HideRows[e.RowIndex] )
{
int iVisibleRowIndex = GetPreviousVisibleRowIndex(_grid.Model,e.RowIndex );
if( iVisibleRowIndex != -1 )
{
if( _grid.GetViewStyleInfo(iVisibleRowIndex,e.ColIndex).BackColor != m_FirstColor )
e.Style.BackColor = m_FirstColor;
else
e.Style.BackColor = m_SecondColor;
}
}
}
}

Best Regards,
Haneef

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.

;