wpf
to delete a selected item in a datagrid using linq
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kiran Kumar TalikotiPosted Dec 12, 2013, 2:30 AM
Bala MuruganPosted Dec 12, 2013, 1:08 AM
code here
passwordEntities de = new passwordEntities();
Kiran Kumar TalikotiPosted Dec 12, 2013, 1:04 AM
Suppose i have taken example Of Employee Class and selecting id and DB means you Context Class Object.Make some changes as per your requirement
int pid = ((Employee)dataGrid2.SelectedItem).Id;
var query = (from t in DB.employees
where t.Id == pid
select t).First();
DB.employees.Remove(query);
DB.SaveChanges();