Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

check value when end edit cell in datagrid wpf c#

$
0
0

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


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>