fiogf49gjkf0d I have ran into the same situation in the past.
Basically, once you apply a condition, even if it is programatically, it won't revert back until the site is restarted....
Now, here is a potential solution, thiking out of the box:
On your form, place 2 Lookup Controls, one with the Condition and one without the Condition.
Use your Code to dynamically filter which Control is being displayed on the Screen.
Off course, this also means that one control would probably be unbound, but you could always have code on the Opening of the Form and on the Closing of the Form to sync the values.
e.g.
OnLoad
myLookupWithConds.LookupResultValue = myLookup.LookupResultValue;
On Save ( or on myLookupWithConds On Lookup Value Change event):
myLookup.LookupResultValue = myLookupWithConds.LookupResultValue;
On your Code:
bool useFiltering = MyLogic();
myLookup.Visible = !useFiltering;
myLookupWithConds.Visible = !useFiltering; |