ComponentOne True DBGrid for WinForms
True DBGrid for WinForms Task-Based Help / Getting the DataRow for a Row Index After Sorting or Filtering
In This Topic
    Getting the DataRow for a Row Index After Sorting or Filtering
    In This Topic

    When sorting or filtering is applied to the grid, it uses the underlying DataView of the DataSource and DataMember. To get the DataRow for a row index after the sort or filter, access the same underlying list as accessed by the grid with the following code:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    If Me.C1TrueDBGrid1.FocusedSplit.Rows(Me.C1TrueDBGrid1.Row).RowType = C1.Win.C1TrueDBGrid.RowTypeEnum.DataRow Then
        Dim dr As System.Data.DataRowView = CType(Me.C1TrueDBGrid1(Me.C1TrueDBGrid1.RowBookmark(Me.C1TrueDBGrid1.Row)), System.Data.DataRowView)
    End If
    

    To write code in C#

    C#
    Copy Code
    if (this.c1TrueDBGrid1.FocusedSplit.Rows[this.c1TrueDBGrid1.Row].RowType == C1.Win.C1TrueDBGrid.RowTypeEnum.DataRow)
    {
        System.Data.DataRowView dr = (System.Data.DataRowView)this.c1TrueDBGrid1[this.c1TrueDBGrid1.RowBookmark(this.c1TrueDBGrid1.Row)];
    }