Hi – I’d like to use the .Invalid property and the .InvalidMessage properties to perform passive UI validations, but I do not see how they work, other than just as properties. Do I need to provide my own error message display mechanism to display the message if I am not using the error provider?
Got it. If you set Invalid=true in the Validating event Wisej probably sets it back to false since it expects e.Cancel to be set to true to indicate that the control is not validated. Try the Validated event instead. I can see if we can detect the change to the property and preserve it instead of relying only on the Cancel property.
Thanks so much Luca. I am able to produce results using the method you say. But I was trying to dynamically set both properties in the text box validating event. And that doesn’t seem to work as I would (perhaps mistakenly) expect – perhaps due to sequencing of events. However it does work the way I was seeking in the LostFocus event. So that works for my needs.
Thanks very much!
I just tried with two textbox controls on a page, set their InvalidMessage property in the designer to an error message, then in a button click handler I set their Invalid property to true. The result is the textbox controls with a red border and when you place the cursor over the controls you see the error tooltip with the message.
Basically, when you set Invalid = true, Wisej applies the “invalid” state which is styled in the theme. You can decide how to decorate invalid controls. The InvalidMessage is set to the invalid tooltip. The invalid tooltip can also be themed. See the Controls page in the ThemeBuilder.
When you handle the Validating event and set e.Cancel = true, Wisej sets the Invalid property to true, with the same result as if you did it in your code.
The error provider is different, it adds an icon next to the invalid controls.
Please login first to submit.