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
- <script language =javascript type="text/javascript">
- function Total()
- {
- var int1=parseInt(document.getElementById("ctl00_contentPlaceHolder_GridView1_ctl02_TextBox1").value);
- var int2 = parseInt(document.getElementById("ctl00_contentPlaceHolder_GridView1_ctl02_TextBox2").value);
- var int3 = parseInt(document.getElementById("ctl00_contentPlaceHolder_GridView1_ctl02_TextBox3").value);
- var int4 = parseInt(document.getElementById("ctl00_contentPlaceHolder_GridView1_ctl02_TextBox4").value);
- var int5 = (int2-int1+int4-int3);
- document.getElementById("ctl00_contentPlaceHolder_GridView1_ctl02_lblTotalH r").innerText = int5;
- }
- </script>
document.getElementById("<%=GridView1.TextBox1.Cli entID%>") but throws error
plz help