Gets the Row, corresponding to the index in the attached datasource.

Namespace: Dapfor.Net.Ui
Assembly: Dapfor.Net (in Dapfor.Net.dll) Version: 2.10.3.24917 (2.10.3.24917)

Syntax

C#
[ObsoleteAttribute("Use Grid.DataSourceRows instead")]
public Row FindRow(
	int indexInDataSource
)
Visual Basic
<ObsoleteAttribute("Use Grid.DataSourceRows instead")>
Public Function FindRow ( 
	indexInDataSource As Integer
) As Row
Visual C++
public:
[ObsoleteAttribute(L"Use Grid.DataSourceRows instead")]
Row^ FindRow(
	int indexInDataSource
)
F#
[<ObsoleteAttribute("Use Grid.DataSourceRows instead")>]
member FindRow : 
        indexInDataSource : int -> Row 

Parameters

indexInDataSource
Type: System..::..Int32
The index in the attached datasource.

Return Value

Type: Row
Row, corresponding to the index in the attached datasource

Examples

 Copy imageCopy
public void SetDataSource(Grid grid)
{
    //Build a small datatable
    DataTable table = new DataTable();
    table.Columns.Add(new DataColumn("Column1"));
    table.Columns.Add(new DataColumn("Column2"));
    table.Rows.Add(new object[] { "Row0, Col0", "Row0, Col1" });
    table.Rows.Add(new object[] { "Row1, Col0", "Row1, Col1" });
    table.Rows.Add(new object[] { "Row2, Col0", "Row2, Col1" });

    //Attach datatable to the grid
    grid.Headers.AutoGenerate = true;
    grid.DataSource = table;

    //Get the first row in Grid
    Row row1 = grid.Rows[0];
    Console.WriteLine("Row1, Column1: value = {0}", row1["Column1"].Value);
    Console.WriteLine("Row1: index in Grid: {0}, index in Datasource = {1}", row1.VisibleIndex, row1.DataSourceIndex);

    //Sort the grid
    grid.Headers[0]["Column1"].SortDirection = SortDirection.Descending;
    Console.WriteLine("Row1: index in Grid: {0}, index in Datasource = {1}", row1.VisibleIndex, row1.DataSourceIndex);

    //Filter the row1
    row1.Filtered = true;
    Console.WriteLine("Row1: index in Grid: {0}, index in Datasource = {1}", row1.VisibleIndex, row1.DataSourceIndex);

    //Other row...
    Row row2 = grid.Rows[0];
    Console.WriteLine("Row2: index in Grid: {0}, index in Datasource = {1}", row2.VisibleIndex, row2.DataSourceIndex);
    Console.WriteLine("Row2, Column1: value = {0}", row2["Column1"].Value);
}

Output:
Row1, Column1: value = Row0, Col0
Row1: index in Grid: 0, index in Datasource = 0
Row1: index in Grid: 2, index in Datasource = 0
Row1: index in Grid: -1, index in Datasource = 0
Row2: index in Grid: 0, index in Datasource = 2
Row2, Column1: value = Row2, Col0

See Also