Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7677805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:30:22+00:00 2026-05-31T17:30:22+00:00

I am having difficulties in assigning double value (for example 124.00) of label text

  • 0

I am having difficulties in assigning double value (for example 124.00) of label text in asp.net. This label is in content page of .net master page.

But I am having the following two problems:

<script type="text/javascript">
 var totalAmount = 0; //Defined global variable;

function addval(vals)  //I am passing vals(Double from sever side)
{
totalAmount = totalAmount + vals;
(document.getElementsByTagName("<%= lblCurrentProductTotal.ClientID %>")).value= totalAmount.toString();
}


</script>
  • Each time “clickCh” is called; this sets the totalAmount (a global variable) with the parameter passed. It’s like if I pass 145 first time it assigns as "0145" and second time if I pass 156 the totalAmount becomes "0145156" as I am expecting it to add as 145+156=301.

  • It’s not assigning the value to the label “lblCurrentProductTotal”
    Please let me know if i am missing something.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:30:23+00:00Added an answer on May 31, 2026 at 5:30 pm

    You are concatenating strings instead of adding doubles.

    Either make sure that vals is passed as a number or turn it into a number using parseFloat like below.

    var totalAmount = 0; //Defined global variable;
    
    function addval(vals)  //I am passing vals(Double from sever side)
    {
        vals = parseFloat(vals);
        totalAmount = totalAmount + vals;
        (document.getElementsByTagName("<%= lblCurrentProductTotal.ClientID %>")).value= totalAmount.toString();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having difficulties with forms, specifically ModelMultipleChoiceField. I've pieced together this code from
I'm having difficulties grasping how to do this. I am making a product options
I'm having difficulties adding momentum to my spinning wheel. I have this wheel (something
I am having difficulties applying my custom 404 page in Drupal. So first I
im having difficulties figuring this out, ive looked at examples here and on the
I am having difficulties with this code where I'm trying to put a certain
I'm having difficulties believing this question hasn't been asked before, but I couldn't find
So I'm almost done with this assignment but now I'm having difficulties again. When
I'm having difficulties in reading a particular cell value from Excel in xlrd. Whatever
I am having difficulties figuring this out. I can see I am posting XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.