mallorn
mallorn

Reputation: 815

ADGV C# DataGridView - find DataRow to update SQL

I'm trying to use auto-generated advancedDataGrid - ADGV (adgv.codeplex.com).

My advancedDataGridView1 contains "default" procedures to update-insert-delete SQL tables.

Update requires DataRow property from the DataGrid, which I'm looking for.

For example: it is filled with data (linked to SQL table) this way:

this.lTableAdapter.Fill(this.sQLDataSet.Lev);

Question: how to get DataRow property for the selected row or column?

int RowIndexNo = advancedDataGridView1.CurrentCell.RowIndex;
int ColIndexNo = advancedDataGridView1.CurrentCell.ColumnIndex;
this.lTableAdapter.Update(_TODO_DataRow_)

Upvotes: 0

Views: 120

Answers (1)

Avo Nappo
Avo Nappo

Reputation: 630

Try this:

int rowIdx = dataGridView1.CurrentCell.RowIndex;
DataRowView drv = (DataRowView)advancedDataGridView1.Rows[rowIdx].DataBoundItem;
DataRow dr = drv.Row;

Upvotes: 1

Related Questions