How to get the current record when clicking the push button in cell selection mode in WinForms GridGroupingControl?
Selection mode
By default, the current record of our WinForms GridGroupingControl page cannot be obtained when clicking the Push button in cell-based selection mode (using the AllowSelection property). The record can be obtained by using the TableControlPushButtonClick event and TableCellIdentity property.
C#
this.gridGroupingControl1.TableControlPushButtonClick += GridGroupingControl1_TableControlPushButtonClick;
private void GridGroupingControl1_TableControlPushButtonClick(object sender,GridTableControlCellPushButtonClickEventArgs e)
{
GridTableCellStyleInfo style =this.gridGroupingControl1.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
Record record = style.TableCellIdentity.DisplayElement.GetRecord();
if (record != null)
{
var value = record.GetValue("Name");
}
}
VB
AddHandler Me.gridGroupingControl1.TableControlPushButtonClick, AddressOf GridGroupingControl1_TableControlPushButtonClick
Private Sub GridGroupingControl1_TableControlPushButtonClick(ByVal sender As Object, ByVal e As GridTableControlCellPushButtonClickEventArgs)
Dim style As GridTableCellStyleInfo =Me.gridGroupingControl1.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex)
Dim record As Record = style.TableCellIdentity.DisplayElement.GetRecord()
If record IsNot Nothing Then
Dim value = record.GetValue("Name")
End If
End Sub
Conclusion
I hope you
enjoyed learning about how to get the current record when clicking the push
button in cell selection mode in 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 forums, Direct-Trac, or feedback portal. We are always happy to assist you!