RequiredFieldValidators not being re-evalauated
Posted on 2010-01-05
I have a number of text boxes that are validated by required field validators, as well as a submit button. The submit button does a quick Page.IsValid check, and if it is valid, proceeds with my code. Part of my code is to open a ModalPopupExtender which then displays the values that the user entered in the text boxes, and then provides an "OK" and "Cancel" button.
This is just a final review for the user to verify everything they entered was correct. If the user chooses OK, everything proceeds correctly. If the user chooses "Cancel" they are returned to the page to change their data.
In this situation (the user clicks "Cancel") however, the users can erase the data they previously entered from required fields. If they do so, then hit the "Submit" button once again, the field validators on the page are triggered, but my Submit button's Page.IsValid check is bypassed and the ModalPopupExtender appears again, displaying the old data (even though they erased the data in the required fields).
It appears that, since the first page validation was true (all fields were valid) that this valid state is somehow stored, and not re-evaluated when the user returns from clicking the "Cancel" button in the MPE.
Does clicking the "Cancel" button in the MPE automatically exit the "Submit" button's Click Event? Is there a way to tell my application that when the MPE's "Cancel" button is clicked, I should exit the "Submit" button's Click event, and re-evaluate the required fields?
I apologize if that's not very clear, I tried to explain it as simply as I could.