Validation which accept( empty, numeric or Float values)

Now we have to discuss about the validationexpression ie:

the textbox should accept empty values , numeric ( float )

.Implementation Code :
^\d*\.?\d*$
HTML



<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator3"
        runat="server" ErrorMessage="Invalid format" 
ControlToValidate="TextBox3" ValidationExpression="^\d*\.?\d*$" 
ValidationGroup="d"></asp:RegularExpressionValidator>
<asp:Button ID="Button5" runat="server" Text="Button"
ValidationGroup="d" />

Matches

( ) -> empty value
4535
520.20
2.54
Non-Matches
21.0dfdf
47854
Rpks

If you have better solution, just tell me !

0 comments: