Question:You have created a webpage that contains many controls that are validated by using validation controls. This page also contains Button controls that perform postbacks. You disabled all of the client-side validation and noticed that when you clicked any
of the Button controls, the code in the Click event handler was executing even when some of the controls did not have valid data. How can you best solve this problem to ensure that code is not executed when invalid data exists?
A In the Click event handler method for each of your Button controls, test the
webpage’s IsValid property and exit the method if this property is false.
B In the Load event handler method of the webpage, test the webpage’s IsValid
property and exit the method if this property is false.
C Re-enable the client-side script to disable postback until valid data exists.
D Add the runat="server" attribute to all of the validation controls.