Friday, 11 July 2014

In GridView Textbox only take number in Javascript


    <script type="text/javascript" language="javascript">
 function checkDec(el){
 var ex = /^[0-9]+\.?[0-9]*$/;
 if(ex.test(el.value)==false){
   el.value = el.value.substring(0,el.value.length - 1);
  }
}
    </script>
//InGridView  (Onkey up



                                                                 <asp:TextBox ID="txtInsurance"  onkeyup ="checkDec(this);"  Width="80px" Text='<%# Eval("InsurancePrice", "{0:N}")%>'
                                                                    runat="server" />

No comments:

Post a Comment