public void DeleteDetailRow() { if (SelectedDetailRows != null) { var res = MessageBox.Show("Are You To Delete SelectedRecords From Database ?", "Delete", MessageBoxButton.OKCancel); if (res == MessageBoxResult.OK) { foreach (var row in SelectedDetailRows) { if (row.Iserial != 0) { if (AllowDelete != true) { MessageBox.Show(strings.AllowDeleteMsg); return; } Loading = true; Glclient.DeleteTblCostCenterShopAreaAsync( (TblCostCenterShopArea) new TblCostCenterShopArea().InjectFrom(row), SelectedMainRow.DetailsList.IndexOf(row), LoggedUserInfo.DatabasEname); } else { SelectedMainRow.DetailsList.Remove(SelectedDetailRow); if (!SelectedMainRow.DetailsList.Any()) { AddNewDetailRow(false); } } } } } }