Articles in this section
Category / Section

How to use a PushButton in a cell and catch the user clicking it in WinForms GridGroupingControl?

1 min read

Use the CellType property to set a PushButton in a cell, and use the TableControlPushButtonClick event to get the button click action.

C#

//To set PushButton.
this.gridGroupingControl1.TableDescriptor.Columns["Description"].Appearance.AddNewRecordFieldCell.CellType = GridCellTypeName.PushButton;
this.gridGroupingControl1.TableDescriptor.Columns["Description"].Appearance.AddNewRecordFieldCell.Description = "PushButton";

//Event Subscription
this.gridGroupingControl1.TableControlPushButtonClick += new GridTableControlCellPushButtonClickEventHandler(gridGroupingControl1_TableControlPushButtonClick);

//Event Customization
void gridGroupingControl1_TableControlPushButtonClick(object sender, GridTableControlCellPushButtonClickEventArgs e)
{
    string s = string.Format("You clicked ({0},{1}).", e.Inner.RowIndex, e.Inner.ColIndex);
    MessageBox.Show(s);
}
VB
'To set PushButton.
Me.gridGroupingControl1.TableDescriptor.Columns(2).Appearance.AddNewRecordFieldCell.CellType = GridCellTypeName.PushButton
Me.gridGroupingControl1.TableDescriptor.Columns(2).Appearance.AddNewRecordFieldCell.Description = "PushButton"

 'Event subscription
AddHandler gridGroupingControl1.TableControlPushButtonClick, AddressOf gridGroupingControl1_TableControlPushButtonClick
 
'Event Customization
Private Sub gridGroupingControl1_TableControlPushButtonClick(ByVal sender As Object, ByVal e As GridTableControlCellPushButtonClickEventArgs)
 Dim s As String = String.Format("You clicked ({0},{1}).", e.Inner.RowIndex, e.Inner.ColIndex)
 MessageBox.Show(s)
End Sub

View sample in GitHub

 

Conclusion


I hope you enjoyed learning how to use a PushButton in a cell and catch the user clicking it in WinForms GridGroupingControl.


You can refer to our WinForms GridGroupingControl feature tour page to know about its other groundbreaking feature representations and WinForms GridGroupingControl documentation, and how to quickly get started for configuration specifications.

 

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

 

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

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