Conversion Number value to Words (String) using Java Script and

In this article, we are convert the numeric value in to words (string). Here we use a text box and a button to show the example, in the textbox we validate that it takes only numeric value using java script. Basically this code helps you to generate the bill and conversion the amount (numeric to words).
If we are trying to some word or correct the we get this type of error message.

Source code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="numbertostring.aspx.cs" Inherits="numbertostring" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
    <script type="text/javascript">
        var specialKeys = new Array();
        specialKeys.push(8); //Backspace
        function IsNumeric(e) {
            var keyCode = e.which ? e.which : e.keyCode
            var ret = ((keyCode >= 48 && keyCode <= 57) || specialKeys.indexOf(keyCode) != -1);
            document.getElementById("error").style.display = ret ? "none" : "inline";
            return ret;
    <style type="text/css">
            font-size: medium;
    <form id="form1" runat="server">
        <fieldset style="width: 300px;">
            <legend><strong><span class="style1">Convert Number to Words</span> </strong></legend>
            <strong><span class="style1">Enter Value:</span></strong>
            <asp:TextBox ID="txtnumber" runat="server" onkeypress="return IsNumeric(event);"
                ondrop="return false;" onpaste="return false;" />
                <br />
            <br />
            <asp:Button ID="btnclick" runat="server" Text="Convert" OnClick="btnclick_Click"
                Style="height: 26px" /><br />
            <br />
            <label id="lbshow" runat="server" />
        <span id="error" style="display: none">Please enter only numeric value

Out Put:-

Conversion Number value to Words (String) using Java Script and Conversion Number value to Words (String) using Java Script and Reviewed by NEERAJ SRIVASTAVA on 2:50:00 PM Rating: 5

1 comment:

Powered by Blogger.