Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have a web form that has textboxes for calculation. I have two textboxes for subtration and three for adding. I am using jquery to mask the textboxes for money value. THe textboxes work with out the masked being there. The calculation is correct for the textboxes. I just added the jquery to the code to mask the textboxes and it works but the calculations has stopped working. How can I fix this?

Masking code:

HTML
<script src="Scripts/jquery-2.1.1.min.js" type="text/javascript"></script>
    <script src="Scripts/jquery.maskMoney.js" type="text/javascript"></script>
    <script type='text/javascript'>
        $(document).ready(function () {
            $("#TextBoxTROA").maskMoney();
            $("#TextBoxInstr").maskMoney();
            $("#TextBoxRes").maskMoney();
            $("#TextBoxPubS").maskMoney();
            $("#TextBoxAcad").maskMoney();
            $("#TextBoxStudS").maskMoney();
            $("#TextBoxInstiS").maskMoney();
            $("#TextBoxOperM").maskMoney();
            $("#TextBoxAuxE").maskMoney();
            $("#TextBoxHosS").maskMoney();
            $("#TextBoxLYIndeO").maskMoney();
            $("#TextBoxOED").maskMoney();
            $("#TextBoxTA").maskMoney();
            $("#TextBoxTL").maskMoney();
            $("#TextBoxTUNA").maskMoney();
            $("#TextBoxETRNA").maskMoney();
            $("#TextBoxNPRNA").maskMoney();
            $("#TextBoxTR").maskMoney();
            $("#TextBoxTFN").maskMoney();
            $("#TextBoxCD").maskMoney();
            $("#TextBoxLTD").maskMoney();
            $("#TextBoxSFEDA").maskMoney();
            

        });
    </script>


Calculation codes:

C#
protected void TextBoxTA_TextChanged(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(TextBoxTA.Text) && !string.IsNullOrEmpty(TextBoxTL.Text))
            TextBoxTNA.Text = (Convert.ToInt64(TextBoxTA.Text) - Convert.ToInt64(TextBoxTL.Text)).ToString();
        TextBoxTL.Focus();
    }

    protected void TextBoxTUNA_TextChanged(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(TextBoxTUNA.Text) && !string.IsNullOrEmpty(TextBoxETRNA.Text) && !string.IsNullOrEmpty(TextBoxNPRNA.Text))
            TextBoxTNA2.Text = (Convert.ToInt64(TextBoxTUNA.Text) + Convert.ToInt64(TextBoxETRNA.Text) + Convert.ToInt64(TextBoxNPRNA.Text)).ToString();
        TextBoxETRNA.Focus();
    }

    protected void TextBoxETRNA_TextChanged(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(TextBoxTUNA.Text) && !string.IsNullOrEmpty(TextBoxETRNA.Text) && !string.IsNullOrEmpty(TextBoxNPRNA.Text))
            TextBoxTNA2.Text = (Convert.ToInt64(TextBoxTUNA.Text) + Convert.ToInt64(TextBoxETRNA.Text) + Convert.ToInt64(TextBoxNPRNA.Text)).ToString();
        TextBoxNPRNA.Focus();
    }
 protected void TextBoxTL_TextChanged(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(TextBoxTA.Text) && !string.IsNullOrEmpty(TextBoxTL.Text))
            TextBoxTNA.Text = (Convert.ToInt64(TextBoxTA.Text) - Convert.ToInt64(TextBoxTL.Text)).ToString();
        TextBoxTUNA.Focus();
    }

    protected void TextBoxNPRNA_TextChanged(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(TextBoxTUNA.Text) && !string.IsNullOrEmpty(TextBoxETRNA.Text) && !string.IsNullOrEmpty(TextBoxNPRNA.Text))
            TextBoxTNA2.Text = (Convert.ToInt64(TextBoxTUNA.Text) + Convert.ToInt64(TextBoxETRNA.Text) + Convert.ToInt64(TextBoxNPRNA.Text)).ToString();
        TextBoxTR.Focus();
    }


Please Help!!1
Posted
Comments
CBadger 25-Jul-14 3:33am    
How exactly does MaskMoney() mask the values?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900