True DBGrid for WinForms | ComponentOne
C1.Win.TrueDBGrid.8 Assembly / C1.Win.TrueDBGrid.BaseGrid Namespace / ViewRow Class / DataRowIndex Property
Example

In This Topic
    DataRowIndex Property (ViewRow)
    In This Topic
    Gets index of the row in data source.
    Syntax
    'Declaration
     
    Public ReadOnly Property DataRowIndex As System.Integer
    public System.int DataRowIndex {get;}
    Remarks

    Returns -1 if there is not corresponding data row. For example, for a group row.

    Use DataRowIndex property to translate view row index to data row index.

    Example
    private void c1TrueDBGrid1_FetchCellStyle(object sender, C1.Win.C1TrueDBGrid.FetchCellStyleEventArgs e)
    {
        ViewRow row = this.c1TrueDBGrid1.Splits[0].Rows[e.Row];
        if (row.RowType == RowTypeEnum.DataRow)
        {
            bool val = (bool)this.c1TrueDBGrid1[row.DataRowIndex, 3];
            if (val == true)
                e.CellStyle.BackColor = Color.Red;
        }
    }
    See Also