check if the current row is marked for delete
-
Monday, May 14, 2012 10:55 PM
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?
Gus
All Replies
-
Tuesday, May 15, 2012 6:31 AM
You can use CanExecute method of button control:
result = Products.SelectedItem != null && Products.SelectedItem.Details.EntityState != EntityState.Deleted;
- Proposed As Answer by Simon Jones [MSDL] Tuesday, May 15, 2012 7:34 AM
- Marked As Answer by GusBeare Tuesday, May 15, 2012 7:53 AM
-
Tuesday, May 15, 2012 7:54 AM
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!

