Friday, 14 September 2012

Use this regular expression to allow only single dot


Use this regular expressin to allow only single dot
^[1-9]\d*(\.\d+)?$


 <asp:TextBox ID="txtNumber" runat="server"></asp:TextBox>
                    <asp:RegularExpressionValidator ControlToValidate="txtNumber"
                    runat="server" ValidationExpression="^[1-9]\d*(\.\d+)?$"
                        ErrorMessage="Please enter only numbers">
                    </asp:RegularExpressionValidator>

No comments:

Post a Comment