GroupingGrid: Get cell''s source object by clicking on the cell
Hi again!
I''d like to know how to get a certain source object of a Grouping Grid by clicking on the cell that is suppossed to be displaying its info.
I can''t find a way to do this, but I''m sure that there has to be an easy way. Is there any GetData method that allow to reach the underlying data of a cell? My DataSource is an ArrayList of ArrayList, and I have a GroupingGrid with a nested table.
Thanks a lot!
SIGN IN To post a reply.
3 Replies
AD
Administrator
Syncfusion Team
April 22, 2005 02:33 PM UTC
Here is code you can use in teh TableControlCellClick event to get the clicked value.
'' subscribe to the event
AddHandler Me.gridGroupingControl1.TableControlCellClick, AddressOf TableControl_CellClick
''the event handler
Private Sub TableControl_CellClick(ByVal sender As Object, ByVal e As GridTableControlCellClickEventArgs)
Dim cc As GridCurrentCell = e.TableControl.CurrentCell
Dim style As GridTableCellStyleInfo = e.TableControl.Model(cc.RowIndex, cc.ColIndex)
Dim recRow As GridRecordRow = style.TableCellIdentity.DisplayElement
If Not recRow Is Nothing AndAlso Not recRow.ParentRecord Is Nothing Then
Dim val As Object = recRow.ParentRecord.GetValue(style.TableCellIdentity.Column.MappingName)
Console.WriteLine(val.ToString())
End If
End Sub
AD
Administrator
Syncfusion Team
April 22, 2005 02:49 PM UTC
Looks like the checks in teh above code are not sufficient. Try this code instead.
Private Sub TableControl_CellClick(ByVal sender As Object, ByVal e As GridTableControlCellClickEventArgs)
Dim cc As GridCurrentCell = e.TableControl.CurrentCell
Dim style As GridTableCellStyleInfo = e.TableControl.Model(cc.RowIndex, cc.ColIndex)
If style.TableCellIdentity.TableCellType = GridTableCellType.RecordFieldCell Or style.TableCellIdentity.TableCellType = GridTableCellType.AlternateRecordFieldCell Then
Dim recRow As GridRecordRow = style.TableCellIdentity.DisplayElement
Dim val As Object = recRow.ParentRecord.GetValue(style.TableCellIdentity.Column.MappingName)
Console.WriteLine(val.ToString())
End If
End Sub
RO
Roberto Obispo
April 25, 2005 07:59 AM UTC
Works great! Thanks a lot, Clay.
I''ve finally used
recRow.GetData()
to get the source record.
Again, thank you very much for your support!
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
RO Roberto Obispo
- Apr 22, 2005 01:49 PM UTC
- Apr 25, 2005 07:59 AM UTC