ASP.Net Validation Controls
RequiredFieldValidator Control
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="TextBox1" Display="Dynamic" runat="server" ErrorMessage="Enter your name"></asp:RequiredFieldValidator>
Example
Click below submit button to check RequiredFieldValidator Control
CompareValidator Control
<asp:CompareValidator ID="CompareValidator1" runat="server" controltovalidate="TextBox3" controltocompare="TextBox1" operator="LessThan" type="Integer" errormessage="Password is not matching" />
Example
Click below submit button to check CompareValidator Control
RangeValidator Control
<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="TextBox4" ErrorMessage="Your age must be between 18 to 40 years" MaximumValue="40" MinimumValue="18" Type="Integer">
Example
Click below submit button to check RangeValidator Control
RegularExpressionValidator Control
<asp:RegularExpressionValidator ID="remail" runat="server" Display="Dynamic" ControlToValidate="TextBox4" ErrorMessage="Enter valid email address. Eg. Something@domain.com" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"> </asp:RegularExpressionValidator>
Example
Click below submit button to check RegularExpressionValidator Control
ValidationSummary Control
<asp:validationsummary runat="server" id="validationSummary"> </asp:validationsummary>
Example
Click below submit button to check ValidationSummary Control