Decimal Validation in asp.net C# :-
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="Plz Enter Only Decimal"
ControlToValidate="txtMRP" ValidationExpression="^-?[0-9]{0,5}(\.[0-9]{1,2})?$|^-?(100000)(\.[0]{1,5})?$"></asp:RegularExpressionValidator>
{0,5} - Indicate no.of digit to be allowed, so customized as per requirement.
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="Plz Enter Only Decimal"
ControlToValidate="txtMRP" ValidationExpression="^-?[0-9]{0,5}(\.[0-9]{1,2})?$|^-?(100000)(\.[0]{1,5})?$"></asp:RegularExpressionValidator>
{0,5} - Indicate no.of digit to be allowed, so customized as per requirement.
Comments
Post a Comment