in cheque details datagrid when i want to add a new:
(dep, branch, account, idshek, munt, date)
in a column "idshek" when end edit i want to check:
- check if exist in my database. >> I know that code.
- check if duplicated in my current datagrid. >> before save to database.
my Problem:
when write this code:
private void cS_SHKDataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) {
DataRowView rowview = _grid.ItemContainerGenerator.Items[e.Row.AlternationIndex] as DataRowView;
if (_grid.Focus() && _grid.CurrentCell.Column.DisplayIndex == 10)
{ var idshk = int.parse(rowview.Row[10].tostring()); } }
and when fill details first cheque and after add "idshk" then error show:
rowview is returned null >> or itemarray in a row is null