Hiding rows in a Grid

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.

1 Reply

HA haneefm Syncfusion Team April 16, 2007 10:26 PM UTC

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

Loader.
Up arrow icon