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)+(colum n4-column3)
Here is javascript i am using. When i use this it just calculates for first row of gridview.
i have tried using document.getEle mentById("<%=Te xtBox1.ClientID %>") and
document.getEle mentById("<%=Gr idView1.TextBox 1.ClientID%>") but throws error
plz help
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)+(colum n4-column3)
Here is javascript i am using. When i use this it just calculates for first row of gridview.
Code:
<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_lblTotalHr").innerText = int5; } </script>
document.getEle mentById("<%=Gr idView1.TextBox 1.ClientID%>") but throws error
plz help
Comment