I want to delete the currently selected record. How do I accomplish this? I have this, but it doesn't seem to do anything. I am bound to a dataview.
theDataGrid.DataItems.Remove(theDataGrid.SelectedItems.Records[0]);
theDataGrid.ExecuteCommand(DataPresenterCommands.EndEditModeAndAcceptChanges);
Thanks,
Rod
Hi all,
just for my ignorance i ask if there is an example about XamDataGrid how delete a record in Linq via ObservableCollection...
I'm researching ......but nothing :(.
Thanks for your attention i will be grateful for each comment because i see dark
Bye
Hi,
Thanks for your reply, I got to know new thing about Infragatics.
I tried deleting the record in xdg_RecordUpdating i.e before committing the record, if user has inserted invalid data in a grid, a message box gets displayed and on clicking on NO button record gets deleted, using below line of code.
e.Action = RecordUpdatingAction.CancelUpdateDiscardChanges
Regards,
Mital
I don't know what's wrong with your application, however,in answer to your question - "How to delete the currently selected DataRecord ?" I have created a working sample application to show how you can do it. In my sample I have used a binding to ObservableCollection.How to bind to an ObservableCollection you can learn from the online documentation at http://help.infragistics.com/Help/NetAdvantage/WPF/2008.1/CLR3.X/html/WPF_Binding_to_an_ObservableCollection.html
To make things easy I have used the LibraryBusinessLogic class from the online documentation at http://help.infragistics.com/Help/NetAdvantage/WPF/2008.1/CLR3.X/html/WPF_LibraryBusinessLogic.html .
The attached DeleteSelectedRow sample application contains the full solution implementation.
Best Regards,Yanko
I tried using theDataGrid.ExecuteCommand(DataPresenterCommands.DeleteSelectedDataRecords), but my record is not getting deleted. I don't understand why?
I have to something else to achieve the task.
Thanks in advance.
Nevermind, I figured it out myself...
theDataGrid.ExecuteCommand(DataPresenterCommands.DeleteSelectedDataRecords);