in Education by
I have a basic form with controls that are databound to an object implementing the INotifyPropertyChanged interface. I would like to add some validation to a couple of properties but dont want to go through implementing IDataErrorInfo for the sake of validating a couple of properties. I have created the functions that perform the validation and return the error message (if applicable) in the object. What I would like to do is call these functions from my form when the relevant properties on the object have changed, and setup the ErrorProvider control in my form with any error messages that have been returned from the validation functions. I have tried hooking up event handlers to the Validating and LostFocus events, but these seem to fire before my object is updated, and hence they are not validating the correct data. Its only when I leave the textbox, go back in and then leave again that the validation runs against the correct data. Is there another event that I can hook into so that I can call these validation functions after the property on my object has been updated? Or am I better off just implementing the IDataErrorInfo interface? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
I'm not sure exactly what the problem is, are you saying that you can't get the property to set until the control loses focus? If so, you need to set the binding to update OnPropertyChanged instead of OnValidation. Binding to OnPropertyChanged means the binding is updated immediately, while OnValidation only updates the underlying object when a Validation is triggered (which for most controls is when they lose focus).

Related questions

0 votes
    This question's answers are a community effort. Edit existing answers to improve this post. It is not ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    I have some ASP.NET web services which all share a common helper class they only need to instantiate one ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 31, 2022 in Education by JackTerrance
0 votes
    I have some ASP.NET web services which all share a common helper class they only need to instantiate one ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 30, 2022 in Education by JackTerrance
0 votes
    I have some ASP.NET web services which all share a common helper class they only need to instantiate one ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 29, 2022 in Education by JackTerrance
0 votes
    I have some ASP.NET web services which all share a common helper class they only need to instantiate one ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 29, 2022 in Education by JackTerrance
0 votes
    In C# when I am done entering the fields of a snippet, I can hit Enter to get to the next line. ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 20, 2022 in Education by JackTerrance
0 votes
    In C# when I am done entering the fields of a snippet, I can hit Enter to get to the next line. ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I want to be able to compare an image taken from a webcam to an image stored on my computer. The ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 10, 2022 in Education by JackTerrance
0 votes
    I was recently trying to explain to a programmer why, in ASP.Net, they should create HTMLControls instead ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 10, 2022 in Education by JackTerrance
0 votes
    MSDN: Every Visual Basic application must contain a procedure called Main. I... Didn't find such a ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 21, 2022 in Education by JackTerrance
0 votes
    9. Cancel button (x on formula bar) can be used to undo a cell entry after it has been completed (a) True (b) ... ) Alt+P (d) Ctrl+P Select the correct answer from above options...
asked Dec 13, 2021 in Education by JackTerrance
0 votes
    The __________________ contains a list of pages that have been updated in the database buffer. (a) Dirty ... , Database Interview Questions and Answers for Freshers and Experience...
asked Oct 11, 2021 in Education by JackTerrance
0 votes
    The __________________ contains a list of blocks that have been updated in the database buffer. (a) ... Database Interview Questions and Answers for Freshers and Experience...
asked Oct 11, 2021 in Education by JackTerrance
0 votes
    This question already has an answer here: Object.assign getters and setters in constructor (1 answer) Closed ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
...