hi,
h have gridview1 that contain RepositoryItemLookUpEdit columnto make user choose items :
column Field name : stitems_ID (int(11))
RepositoryItemLookUpEdit Display Member : Name (varchar(255))
RepositoryItemLookUpEdit Value Member : stitems_ID (int(11))
st_itemsBindingSource.DataSource = Context.st_items.Local.ToBindingList();
gridview1 filled with data as : succeed
purchases_itemBindingSource1.DataSource = Context.purchases_item.Where(u => u.pmain_ID == PurchasesID).ToList();
i used Entity framework to insert / update / select ..
insert operation: succeed
for (int ItemImdex = 0; ItemImdex < gridView1.DataRowCount; ++ItemImdex)
{
purchases_item purchasesItem = new purchases_item();
purchasesItem.pmain_ID = lastid;
purchasesItem.stitems_ID = Convert.ToInt32(gridView1.GetRowCellValue(ItemImdex, "stitems_ID"));
.........
Context.purchases_item.Add(purchasesItem);
Context.SaveChanges();
}
Update operation: failed
data loaded from mysql database to gridview successfully and right value appear in repositoryitemlookupedit , but during the update operation
Convert.ToInt32(gridView1.GetRowCellValue(ItemImdex, "stitems_ID"))
return zero value not the selected value.
What I have tried:
gridview1 filled with data as : succeed
purchases_itemBindingSource1.DataSource = Context.purchases_item.Where(u => u.pmain_ID == PurchasesID).ToList();