Validationsin asp.net
Required Field Validations
1)for checking all Alphabetic
<asp:RegularExpressionValidator ID="revtxtNewName" runat="server" Text="*" ToolTip="Enter alphabate " ControlToValidate="txtNewName" ValidationExpression="^[a-zA-Z'.\s]{1,40}$"></asp:RegularExpressionValidator>
2) for checking all Numeric
<asp:RegularExpressionValidator ID="revtxtNewSalary" runat="server" Text="*" ToolTip="Enter numeric value" ControlToValidate="txtNewSalary" ValidationExpression="^[0-9]+$"></asp:RegularExpressionValidator>
2) for alphanumeric password checking
<asp:RegularExpressionValidator id="RegularExpressionValidator1"
ControlToValidate="txtpass"
ValidationExpression="(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{8,10})$"
Display="Static"
ErrorMessage="*"
runat="server"/>
1)for checking all Alphabetic
<asp:RegularExpressionValidator ID="revtxtNewName" runat="server" Text="*" ToolTip="Enter alphabate " ControlToValidate="txtNewName" ValidationExpression="^[a-zA-Z'.\s]{1,40}$"></asp:RegularExpressionValidator>
2) for checking all Numeric
<asp:RegularExpressionValidator ID="revtxtNewSalary" runat="server" Text="*" ToolTip="Enter numeric value" ControlToValidate="txtNewSalary" ValidationExpression="^[0-9]+$"></asp:RegularExpressionValidator>
2) for alphanumeric password checking
<asp:RegularExpressionValidator id="RegularExpressionValidator1"
ControlToValidate="txtpass"
ValidationExpression="(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{8,10})$"
Display="Static"
ErrorMessage="*"
runat="server"/>
Comments
Post a Comment