How do I get a DataRow from a row in a DataGridView

DataRow row = ((DataRowView)DataGridViewRow.DataBoundItem).Row

Assuming you’ve bound an ordinary DataTable.

MyTypedDataRow row = (MyTypedDataRow)((DataRowView)DataGridViewRow.DataBoundItem).Row

Assuming you’ve bound a typed datatable.

See the article on MSDN for more information.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)