473,326 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Javascript calculating total in gridview

parshupooja
159 100+
Hi
I am using asp.net C# and javascript.
I have a gridview with 5 columns and 14 row
column1--column2--column3--column4--column5

Column1 to column4 is textboxes wheresa column5 is label
I am trying to calculate column 5 which is (column2-column1)+(column4-column3)
Here is javascript i am using. When i use this it just calculates for first row of gridview.
Expand|Select|Wrap|Line Numbers
  1.  <script language =javascript type="text/javascript">
  2.   function Total()
  3.   {
  4.                                       var int1=parseInt(document.getElementById("ctl00_contentPlaceHolder_GridView1_ctl02_TextBox1").value);
  5.  
  6.                                       var int2 = parseInt(document.getElementById("ctl00_contentPlaceHolder_GridView1_ctl02_TextBox2").value);
  7.  
  8.                                       var int3 = parseInt(document.getElementById("ctl00_contentPlaceHolder_GridView1_ctl02_TextBox3").value);
  9.  
  10.                                       var int4 = parseInt(document.getElementById("ctl00_contentPlaceHolder_GridView1_ctl02_TextBox4").value);
  11.  
  12.                                       var int5 = (int2-int1+int4-int3);
  13.                              document.getElementById("ctl00_contentPlaceHolder_GridView1_ctl02_lblTotalH  r").innerText = int5;
  14.  
  15.        }
  16.  
  17.       </script>
  18.  
  19.  
i have tried using document.getElementById("<%=TextBox1.ClientID%>") and

document.getElementById("<%=GridView1.TextBox1.Cli entID%>") but throws error

plz help
Sep 20 '07 #1
0 1164

Sign in to post your reply or Sign up for a free account.

Similar topics

53
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
3
by: Amelyan | last post by:
I need to get the total number of items/records returned into GridView. If I just do myGridView.Rows.Count, then it just returns me the total number of items on the page. But if I have, 10...
0
by: jimmy6509 | last post by:
Hello all, asp.net 2.0, VB. Have a simple question that I hope someone can help me with. gridview -> queries for a filtered recordset, example purchase orders attributed to a specific...
10
by: Lisa | last post by:
In translating the formula for calculating lottery odds for various conditions into a Visual Basic Program, I have apparently missed something in that I get errors in the part of the calculation...
0
parshupooja
by: parshupooja | last post by:
Hi All, I have gridview with following columns date--morningin--morningout--afetrnoonin--afetrnoonout I want to create another 6th coulmn which shd display total...
9
parshupooja
by: parshupooja | last post by:
Hi I am using asp.net C# and javascript. I have a gridview with 5 columns and 14 row column1--column2--column3--column4--column5 Column1 to column4 is textboxes wheresa column5 is label I am...
1
by: r786amesh | last post by:
Hello Everybody, My question is I want to display Nested gridview footer total by using javascript. its very urgent pls help me... thnx ramesh
13
by: DDragon | last post by:
ok here is the problem, i have to forms which have values i wish to be added together i can add together the values in one form all right but im having problems with adding the values of the other...
4
by: sumit kale | last post by:
Hi, Can somebody help me resolve my problem ? I am getting error when calculating total using unbound textfiled in subform. I have a main form called purchase_register_master and a subform...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.