Call javascript function as shown below in content or header section:-
<script type="text/javascript">
function isNumberKey(evt, element) {
var charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57))
return true;
return false;
}
</script>
Call javascript function from inside the Textbox :-
<asp:TextBox ID="textbox1" MaxLength="30" runat="server" onkeypress="return isNumberKey(event,this)" ></asp:TextBox>
No comments:
Post a Comment