)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to remove the dropdown button in a cell in WinForms GridControl and GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: November 9, 2017 |
Last Revised Date: February 11, 2020

Remove the dropdown button

By default, the dropdown button will be displayed in the ComboBox, RichText, NumericUpDown and MonthCalender cells to show dropdown dialog. In order to hide the dropdown button of a grid cell, the ShowButtons property of GridStyleInfo can be set to GridShowButtons.Hide.

 

Using GridStyleInfo property

GridControl

C#

this.gridControl1.ColStyles[1].CellType = GridCellTypeName.MonthCalendar;
//To hide the dropdown button
this.gridControl1.ColStyles[1].ShowButtons = GridShowButtons.Hide;

VB

Me.gridControl1.ColStyles(1).CellType = GridCellTypeName.MonthCalendar
'To hide the dropdown button
Me.gridControl1.ColStyles(1).ShowButtons = GridShowButtons.Hide

GridGroupingControl

C#

this.gridGroupingControl1.TableDescriptor.Columns["Date"].Appearance.AnyRecordFieldCell.CellType =GridCellTypeName.MonthCalendar;   
//To hide the cell buttons   
this.gridGroupingControl1.TableDescriptor.Columns["Date"].Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.Hide

VB

Me.gridGroupingControl1.TableDescriptor.Columns("Date").Appearance.AnyRecordFieldCell.CellType =GridCellTypeName.MonthCalendar
'To hide the cell buttons   
Me.gridGroupingControl1.TableDescriptor.Columns("Date").Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.Hide

Using QueryCellStyleInfo event

GridControl

C#

this.gridControl1.ColStyles[1].CellType = GridCellTypeName.MonthCalendar;
//Event Triggering
this.gridGroupingControl1.QueryCellInfo += GridGroupingControl1_QueryCellInfo;
//Event Handling
private void GridGroupingControl1_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellInfoEventArgs e)
{
    if(e.RowIndex > 0 && e.ColIndex == 1)
    {
        //To hide the dropdown button.
        e.Style.ShowButtons = GridShowButtons.Hide;
    }
}

VB

Me.gridControl1.ColStyles(1).CellType = GridCellTypeName.MonthCalendar
'Event Triggering
Private Me.gridGroupingControl1.QueryCellInfo += AddressOf GridGroupingControl1_QueryCellInfo
'Event Handling
Private Sub GridGroupingControl1_QueryCellInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping. GridTableCellInfoEventArgs)
    If e.RowIndex > 0 AndAlso e.ColIndex = 1 Then
        'To hide the dropdown button.
        e.Style.ShowButtons = GridShowButtons.Hide
    End If
End Sub

GridGroupingControl

C#

this.gridGroupingControl1.TableDescriptor.Columns["Date"].Appearance.AnyRecordFieldCell.CellType =GridCellTypeName.MonthCalendar;   
//Event Triggering
this.gridGroupingControl1.QueryCellStyleInfo += GridGroupingControl1_QueryCellStyleInfo;
//Event Handling
private void GridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
    if(e.TableCellIdentity.RowIndex > 0 && e.TableCellIdentity.ColIndex == 4)
    {
        //To hide the dropdown button.
        e.Style.ShowButtons = GridShowButtons.Hide;
    }
}

VB

Me.gridGroupingControl1.TableDescriptor.Columns("Date").Appearance.AnyRecordFieldCell.CellType =GridCellTypeName.MonthCalendar
'Event Triggering
Private Me.gridGroupingControl1.QueryCellStyleInfo += AddressOf GridGroupingControl1_QueryCellStyleInfo
'Event Handling
Private Sub GridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping. GridTableCellStyleInfoEventArgs)
    If e.TableCellIdentity.RowIndex > 0 AndAlso e.TableCellIdentity.ColIndex = 4 Then
        'To hide the dropdown button.
        e.Style.ShowButtons = GridShowButtons.Hide
    End If
End Sub

Screenshot

GridControl

Remove the grid cell button in GridControl

GridGroupingControl

Remove the grid cell button in GridGroupingControl

Samples:

GridControl

C#: HideCellButton_CS

VB: HideCellButton_VB

GridGroupingControl

C#: HideCellButton_CS

VB: HideCellButton_VB 

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
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
Live Chat Icon