Force Validation When Saving

2 posts, 0 answers
  1. Travis Parks
    Travis Parks avatar
    7 posts
    Member since:
    Sep 2009

    Posted 28 Jan 2011 Link to this post


    Our controls do not validate until after the user tabs off, which is the default for binding (OnValidating). However, in the case where the use clicks a save button, validation is taking place after the save event fires. This leads to situations where the changes aren't saved and the user closes the form, losing their changes.

    In Windows Forms, you could call ValidateChildren to force the controls to bind to the underlying data object. This doesn't appear to work with Telerik controls.

    Is there a way to force changes to commit to the data object before the save takes place? I don't want to change the binding DataSourceUpdateMode to OnPropertyChanged.

    Travis Parks
  2. Stefan
    Stefan avatar
    2908 posts

    Posted 03 Feb 2011 Link to this post

    Hello Travis Parks,

    Thank you for writing.

    Can you please provide more details for your case - which controls do not validate before the click event of the button? In my test with RadTextBox and RadButton when I edit the text box and click the button the first fired event is the Validating event of the text box and then comes the Click event from the button. 

    As to the ValidateChildren method, we do have such a method in our RadForm, which causes validation on all controls placed on the form. So this is another way of ensuring that your control will be validated.

    I am looking forward to the details regarding the non-validating controls.
    Best wishes,
    the Telerik team
    Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
Back to Top