I have a button on my grid that sets the status of a field in the entity to "Active".
This works fine until I mark a record for delete with the standard delete control.
Problem is that if I then click the button again I get an error. So I need to check if the record is flagged as deleted and if so not try to activate it.
Perhaps pop up a message instead.
I can check for changes across the grid or on selected item but I want to know if the record is flagged for delete.
How can I find this out?
You can use CanExecute method of button control:
result = Products.SelectedItem != null && Products.SelectedItem.Details.EntityState != EntityState.Deleted;
many thanks ninoid!
perfect and even greys out the activate button in the process!
I spent ages trying to find an answer to that one.. really thought it must be simple!
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.
Would you like to participate?