Ticket Q428483
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

Validation - Check validation rules when input focus changes

Execute validation when leaving a field

created 13 years ago

I would like to execute an action (i.e. validate the data of a field) when leaving the field as opposed to validating onSave or onDelete. I know I can make custom contexts for validation - I still cannot figure out how to specify what triggers this custom context, but I know it exists.

I looked at http://www.devexpress.com/Support/Center/e/E449.aspx as well, and it is still unclear how I can handle an event that I would get from most common controls such as a "leave" event.

Answers

created 13 years ago (modified 12 years ago)

Hello,
Thank you for contacting us.
As I see, this example already shows how to handle events of underlying controls:

C#
void editor_ControlCreated(object sender, EventArgs e) { // You can access the corresponding property editor control by the following code: Control editorControl = ((PropertyEditor)sender).Control as Control; editorControl.HandleCreated += editorControl_HandleCreated; } void editorControl_HandleCreated(object sender, EventArgs e) { // Sometimes it is necessary to access editor's control after it is visible (its handle is created). ((Control)sender).HandleCreated -= editorControl_HandleCreated; }

You can handle the Leave event there. Then, in your Leave event handler you can validate your custom context.
In addition to the example you found, I suggest you review the Access Editor Settings help article. I hope this helps.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.