I have this simple code:
<asp:Label ID="litInfo" runat="server" meta:resourceKey="litInfo" />
<br />
<asp:TextBox ID="txtEmail" runat="server" /><br />
<asp:RequiredFieldValidator ID="rfvEmail" runat="server"
ControlToValidate="txtEmail" Display="Dynamic"
ErrorMessage="zadejte e-mailovou adresu" Font-Bold="False"
SetFocusOnError="True" EnableClientScript="True" Font-Names="Tahoma"
Font-Size="Small" />
<asp:RegularExpressionValidator ID="revEmail" runat="server"
ErrorMessage="spatny format e-mailove adresy" ControlToValidate="txtEmail"
Display="Dynamic" Font-Bold="False"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
Font-Names="Tahoma" Font-Size="Small" />
<br />
<span style="margin-left: 230px;"><asp:Button ID="btnSubmit" runat="server" meta:resourceKey="btnSubmit" CausesValidation="True" /></span>
<br />
I am expecting the RequiredFieldValidator control to prevent a postback when the textbox is filled in with an incorrect data and the button pressed. What happens is that the validator displays an error message but a postback is fired. Any suggestions why?