Validate amount in asp.net This code demonstrates how to validate amount in asp.net
<table > <tr> <tr> <td style="width: 161px; height: 29px;"> <asp:Label ID="Label8" runat="server" Text="Required Loan Amount: *" Width="162px"></asp:Label></td> <td style="width: 196px; height: 29px;"> <asp:TextBox ID="txtAmount" runat="server" Width="221px"></asp:TextBox> </td><td style="width: 47px; height: 29px"> <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ControlToValidate="txtAmount" ErrorMessage="Enter Digits Only ($4,000.00) | -$4000.00 | -$400.00 | 12.00" ValidationExpression="^\$?\-?([1-9]{1}[0-9]{0,2}(\,\d{3})*(\.\d{0,2})?|[1-9]{1}\d{0,}(\.\d{0,2})?|0(\.\d{0,2})?|(\.\d{1,2}))$|^\-?\$?([1-9]{1}\d{0,2}(\,\d{3})*(\.\d{0,2})?|[1-9]{1}\d{0,}(\.\d{0,2})?|0(\.\d{0,2})?|(\.\d{1,2}))$|^\(\$?([1-9]{1}\d{0,2}(\,\d{3})*(\.\d{0,2})?|[1-9]{1}\d{0,}(\.\d{0,2})?|0(\.\d{0,2})?|(\.\d{1,2}))\)$" Display="None">*</asp:RegularExpressionValidator></td> </tr> <tr> <td style="width: 161px; height: 5px"> </td> <td style="width: 196px; height: 5px"> <asp:Button ID="Button1" runat="server" Text="Submit" OnClientClick="alert('Do You Want To Submit')" OnClick="Button1_Click" /> <asp:Button ID="Button2" runat="server" Text="Reset" OnClick="Button2_Click" /></td> </tr> </table>
|
| Author: Gopal Singh Rathore 30 Sep 2009 | Member Level: Silver Points : 2 |
|