<script type="text/javascript"> function IsNoDecimal(str) { if (isNaN(str) || str.indexOf(".") < 0) { alert("Invalid"); } else { str = parseFloat(str); alert("Entered number is decimal") } } function ValidateInput() { var txtBox = document.getElementById('TextBox1'); var txtboxValue = document.getElementById('TextBox1').value; if (txtboxValue == "") { alert("Please enter."); txtBox.focus(); return false; } if (IsNoDecimal(txtboxValue) == false) { // num = ""; txtBox.focus(); return false; } return true; } </script>
<div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="javascript:return ValidateInput();" /> </div>
Thanks Tanuja (If this content helped you, Please mark it as Answer)
Login to post response