i have to check a textbox control for validation
Conditions:
contain value 0 to 1000 upto 2 decimal places( 1.00,85.23,1000.00)
after 2 decimal points user wont be able to enter any more zeros.
<script type="text/javascript"> var regex = /\d{0,4}([\.])\d{0,2}/; function keyUP() { var t = document.getElementById('<%=TextBoxPayRate.ClientID%>').value; if (!regex.test(t)) { alert("not matching"); } } </script> <asp:TextBox ID="TextBoxPayRate" runat="server" onkeyup="keyUP();"></asp:TextBox>