Hello
I`m Using 2 DataGrid (Master/Detail) and wanna add new row in both of them, so i`m wrote on button Click event this code.
but when button Click event was end, GridItm.Rows.Cells["pkID"].Value and other Cells has not value.
and when GridItm lost focus Itm new row lost, because has not fkHdrID (it`s Relation) Value.
Regards.
I`m Using 2 DataGrid (Master/Detail) and wanna add new row in both of them, so i`m wrote on button Click event this code.
// Adding Row On Master |
GridHdr.Rows.AddNew(GridHdr.Rows.NewRow()); |
// If new row is first row current row being null then i`m changing it. |
if (GridHdr.CurrentRow == null) |
GridHdr.CurrentRow = GridHdr.Rows[0]; |
// Filling Hdr Primerykey |
GridHdr.CurrentRow.Cells["pkID"].Value = HdrID; |
GridItm.Rows.AddNew(GridItm.Rows.NewRow()); |
// On DetailGrid current row, if is first row thats not null |
if (GridItm.Row.Count == 1) |
GridItm.CurrentRow = GridItm.Rows[0]; |
// Filling Itm PrimeryKey |
GridItm.CurrentRow.Cells["pkID"].Value = ItmID; |
// Filling Itm FKey |
GridItm.CurrentRow.Cells["fkHdrID"].Value = HdrID; |
and when GridItm lost focus Itm new row lost, because has not fkHdrID (it`s Relation) Value.
Regards.