I want the required field validator to become only visible whenever there is an error..not all the time.. How can i achieve so?
<asp:RequiredFieldValidator
runat="server"
ControlToValidate="Editor1"
ErrorMessage="fffffff"
ForeColor="#CC0000"
Display="Dynamic" />
The error message appears as soon as I run the page..I want it to appear whenever there is an error..When the field is empty!!
The only cause of your problem in your current page is that, in the page Load event, somewhere
Page.Validate()is called and you need to to check that.I have tested this sample at my end and the validator is not fired to me at page load.
Can you try this in a separate new Page?
If you check the above mentioned example, it will not fire Validator on page load, but you can add this code, and you will find, the validator is fired on page load..
Please note, I have tested both scenarios on the new page, just try it and you will understand the problem.