Articles in this section
Category / Section

How to get the current record when clicking the push button in cell selection mode in WinForms GridGroupingControl?

1 min read

Selection mode

By default, the current record of the GridGroupingControl 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

 

Sample links:

C#: GridGroupingControl

VB: GridGroupingControl

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