Articles in this section
Category / Section

How to hide the row headers of the ChildTable in the WinForms GridGroupingControl?

1 min read

Hide the row headers

The GridGroupingControl does not have direct support to hide the row headers of the child tables. To hide the Row Headers of the child table, there is a simple solution.

Solution:

You can access the Child Table by using the GridTableModel. Then handle the QueryColWidth of the ChildTable and hide the RowHeader, that is Column zero, by setting the Size property to Zero.

C#

//Gets the ChildTable Model in the Form_Load.
GridTableModel tbl = this.gridGroupingControl1.GetTableModel("ChildTable");
//Hooks the QueryColWidth event to change the width of the Child Table row header.
tbl.QueryColWidth += new GridRowColSizeEventHandler(tbl_QueryColWidth);
//Child Table QueryColWidth event Handler.
private void tbl_QueryColWidth(object sender, GridRowColSizeEventArgs e)
{
   //Checks the col index == 0 to identify.
   if(e.Index == 0)
   {
      //Sets the size of the RowHeader width to zero.
      e.Size = 0;
      e.Handled = true;
   }
}

VB

'Gets the ChildTable Model in the Form_Load.
Private tbl As GridTableModel = Me.gridGroupingControl1.GetTableModel("ChildTable")
'Hooks the QueryColWidth event to change the width of the Child Table row header.
Private tbl.QueryColWidth += New GridRowColSizeEventHandler(AddressOf tbl_QueryColWidth)
'Child Table QueryColWidth event Handler.
Private Sub tbl_QueryColWidth(ByVal sender As Object, ByVal e As GridRowColSizeEventArgs)
   'Checks the col index == 0 to identify. 
   If e.Index = 0 Then
      'Sets the size of the RowHeader width to zero.
      e.Size = 0
      e.Handled = True
   End If
End Sub

Hide the row header in the child table

Figure 1: RowHeader hidden in the ChildTable

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied