ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Getting the DataRow for a Row Index After Sorting or Filtering

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:

·      Visual Basic

If Me.C1TrueDBGrid1.FocusedSplit.Rows(Me.C1TrueDBGrid1.Row).RowType = C1.Win.C1TrueDBGrid.RowTypeEnum.DataRow Then

    Dim dr As System.Data.DataRow = CType(Me.C1TrueDBGrid1(Me.C1TrueDBGrid1.RowBookmark(Me.C1TrueDBGrid1.Row)), System.Data.DataRow)

End If

·      C#

if (this.c1TrueDBGrid1.FocusedSplit.Rows[this.c1TrueDBGrid1.Row].RowType == C1.Win.C1TrueDBGrid.RowTypeEnum.DataRow)

{

    System.Data.DataRow dr = (System.Data.DataRow)this.c1TrueDBGrid1[this.c1TrueDBGrid1.RowBookmark(this.c1TrueDBGrid1.Row)];

}

·      Delphi

if (Self.C1TrueDBGrid1.FocusedSplit.Rows[Self.C1TrueDBGrid1.Row].RowType = C1.Win.C1TrueDBGrid.RowTypeEnum.DataRow) then

  dr := (System.Data.DataRow(Self.C1TrueDBGrid1[Self.C1TrueDBGrid1.RowBookmark(Self.C1TrueDBGrid1.Row)]));


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.