C validating cancel button
You can also disable a validation control so that it is not rendered to the page at all and no validation takes place using that control.
If you want to perform validation on the server but not on the client, you can set an individual validation control to not emit client-side script.
In this example I use simple class named Input Box with static method Show (to be similar to Message Box. It has overloaded static method Show which takes following paramaters: a dialog title, a prompt text, a default value and optionally a validation delegate.
It returns a Dialog Result to detect wheather the OK or the Cancel button has been clicked.
You might want to bypass validation under certain circumstances.
For example, you might have a page in which users should be able to post even if they did not fill out all the validated fields correctly. NET server control to bypass validation on both the server and the client, or just on the client.
This is useful if dynamic updating on the client creates problems with the layout of the page, or if you want to execute some server code before validation takes place.
Now I am forcing the user to make sure that this field is properly filled out before continuing on my form(This is the first textbox on my form).For more information, see the WM_KILLFOCUS topic in the "Keyboard Input Reference" section, and the "Message Deadlocks" section of the "About Messages and Message Queues" topic in the MSDN library at The following code example uses the derived class Text Box and validates an e-mail address that the user enters.You can use this property to allow the user to quickly navigate a simple form by allowing them to simply press the ESC key to close a window without committing changes instead of manually clicking the cancel button with their mouse.may not work if another control on the form intercepts the ESC key.