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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GroupingGrid: Get cell''s source object by clicking on the cell

Thread ID:

Created:

Updated:

Platform:

Replies:

28060 Apr 22,2005 01:49 PM UTC Apr 25,2005 07:59 AM UTC Windows Forms 3
loading
Tags: GridControl
Roberto Obispo
Asked On April 22, 2005 01:49 PM UTC

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!

Administrator [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On 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

Roberto Obispo
Replied On 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!

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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

;