Hi
I have a XamDataGrid and the AllowDelete property is set to TRUE.
When i try to delete a record and save the context, I receive the following error.
I also tried verifying in the Context if i can see the record which was deleted. But, i Do not see any record.But while saving the context it is throwing this error.
Please let me know if i am missing anything...
Thansk & Regards,
Sagar
Hello Sagar,
I am just checking if you have any further questions on this matter. Please do not hesitate to let me know if you do.
I have been looking into your post.
There is a RecordDeleting event of the xamDataGrid, where you can see which record is being deleted. You can use the Records property of the event arguments to see the records, that are being deleted. On the following link from our documentation you can find more information about this event: http://help.infragistics.com/Help/Doc/WPF/2014.1/CLR4.0/html/InfragisticsWPF4.DataPresenter.v14.1~Infragistics.Windows.DataPresenter.DataPresenterBase~RecordsDeleting_EV.html.
Regarding your second question I can suggest to take a look at the first link, that I have provided in my first post. The message you are seeing is not caused by the XamDataGrid. This is caused by the Entity Framework, that you are using as data source. On that first link you would be able to find an explanation for this issue and a possible solution too.
Please do not hesitate to let me know if you have further questions about deleting records from the xamDataGrid.
Hello Gergana,
That's correct. that is one of the question i have asked for. Let me rephrase my question to make it clear:
1. How can i get to know which record is being deleted from the XamDataGrid in my ViewModel (MVVM).
2. I am using XamDataGrid - delete functionality to delete my record. I am not sure how the delete operation is being handled inside the Infragistics code. After Infragistics delete operation is called, i am saving the context using the Context.SaveChanges() methog. which is giving me the above error. So do you think i am missing something step in this schenario?
Regards,
I have been looking into your post and it seems that I am missing something from your scenario. You want to know which record is deleted from the XamDataGrid. Have I understood right?
Thank you for the provided information. Looking forward to hearing from you.
Hi Gergana Dimitrova,
Thanks for answering to my question. I understand it and i see in the blogs you have suggested to use the command call Context.Remove(entity). I am using delete operation from Infragistics grid. I am not sure, how this operation is being handled inside the infragistics code. How can i catch the details of the record being deleted in my ViewModel?
Any suggestions?