Required field validator not validating
Right now, the button does nothing, besides posting back if the page is valid.We will change this by adding an onclick event to it: As you will notice, we check whether or not the page is valid, before we do anything.I'm sure that all the attributes of the controls makes sense by now, so I won't go into details about them. You should see something like this: If your browser supports Java Script, which most modern browers do, then you will notice that the page is not being posted back to the server - the validation is performed clientside! To see how it feels, you can add enableclientscript="false" to the Required Field Validator and try again.Now you will see the browser posting back to the server, but the result will be the same - the validator still works!Most often, the purpose of data validation is to ensure correct user input.Validation can be defined by many different methods, and deployed in many different ways.But if I put a simple code inside it, the validators are not working anymore and more, it will execute the simple code I placed inside the Click property of the button.
My controls look like: I created a brand new webform in the same project with just a single textbox, validator and submit button and it acts the same way. Is there a global or project-wide setting that would cause this behaviour? If I remove the line, my validation works the way I expected it to.I have a question about what could stop a Required Field Validator from preventing a postback.I began working on an older, but simple aspx form and my predecessor used manual, server-side form validation (checking to see if some form fields have a value and if not displaying an error message in a label).A Require Field Validator is attached to the textbox to validate.However, I enter an empty string and no validation occurs.
For other Conditions like Dropdown index change, textbox value change and radio button selection change you can call its onchange, onblur, onclick respectively and After executing the required condition you can Enabled/Disabled the Required Field Validator.