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

How to hide a row based on cellvalue in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl
Tags: hiding, row

Hide a row

In order to hide a particular row based on the Cellvalue, QueryRowHeight can be used. Please refer to the below code snippet. The record can be gained by using from the DisplayElement collection. Then the record’s value can be cached from GetValue method.

The matched search text of the record can be set to zero using the Size property to hide the record.


void TableModel_QueryRowHeight(object sender, GridRowColSizeEventArgs e)
    if (e.Index >= gridGroupingControl1.TableControl.TopRowIndex)
        if (gridGroupingControl1.Table.DisplayElements[e.Index] != null)
            Element el = gridGroupingControl1.Table.DisplayElements[e.Index];
            Record rec = el.GetRecord();
            if (el.Kind == DisplayElementKind.Record && rec != null
            && rec.GetValue("FirstName").Equals("Mary"))//colindex and the respective text.
                e.Size = 0;
                e.Handled = true;




Private Sub TableModel_QueryRowHeight(ByVal sender As Object, ByVal e As GridRowColSizeEventArgs)
    If e.Index >= gridGroupingControl1.TableControl.TopRowIndex Then
        If gridGroupingControl1.Table.DisplayElements(e.Index) IsNot Nothing Then
            Dim el As Element = gridGroupingControl1.Table.DisplayElements(e.Index)
            Dim rec As Record = el.GetRecord()
            If el.Kind = DisplayElementKind.Record AndAlso rec IsNot Nothing AndAlso rec.GetValue("City").Equals("London") Then'colindex and the respective text.
                e.Size = 0
                e.Handled = True
            End If
        End If
    End If
End Sub



Before hide a row in GridGroupingControl



After hide a row in GridGroupingControl


C#: HideRow_CS

VB: HideRow_VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

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

Up arrow icon

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

Live Chat Icon For mobile