I am creating an application to get me started with WPF and using entity frameworks to allow CRUD operations.
So far I am able to add and delete items from a data-grid which loads the contents from a database.
But I'm having problems with my update method.
In the data-grid, when i select a row, and update it, it updates the first row of the table, not the row i selected (third row down for example).
I've posted the code snippets of what I think are important.
private void Page_Loaded(object sender, RoutedEventArgs e)
DBEntities context = new DBEntities();
var orgTypeDetails = (from o in context.OrganisationTypeDetails
dgOrgTypeDetail.ItemsSource = orgTypeDetails;
private void btnUpdateOrgTypeDetail_Click(object sender, RoutedEventArgs e)
OrganisationTypeDetail selected = dgOrgTypeDetail.SelectedItem as OrganisationTypeDetail;
if (selected == null)
MessageBox.Show("You must select a 'Type' before updating.");
OrganisationTypeDetailUpdateView update = new OrganisationTypeDetailUpdateView();
Any help would be much appreciated.
Many thanks, Greg.