Search This Blog

Friday, August 30, 2013

How to easily prevent clearing a lookup field value?

This post is devoted to one more usability improvement in version 13.2

Usability - Make it possible to hide the Clear Action via the application model

In particular, our customers wanted to make it possible to easily hide the Clear Action in lookup Property Editors and thus disallow end-users to clear values for certain fields.

Previously, it was already possible to implement this task in code, but it required writing two platform-dependent Controllers. For instance, in WinForms you could find the LookupWindowController and deactivate its ClearAction in code. As for the Web, you could find a required ASPxLookupPropertyEditor and update the ClearingEnabled property.

Now we simplified it to setting a single AllowDelete property for a required LookupListView node via the Model Editor:


Take special note that after this customization in WinForms app your end-users will not be able to leave the lookup value empty via the Control+Delete shortcut supported by our XtraEditors.

Of course, this also works on the Web:


Although this is not the only way to implement this scenario (e.g., you could also use validation rules here), I hope you liked this small usability improvement. Please let me know your thoughts in comments.

1 comment: