title: How to Calculate the Sum of GridView Columns Using JavaScript?
body: <p>I have a GridView with three COlumns Which will be like this:</p>
  
  <pre><code> ID                  Sign                Amount
  ------              --------             ---------
   1                    +                   1000
   2                    -                    500
   3                    -                    750
  </code></pre>
  
  <p>So the Sum of the Column "Amount" Should be "-250". Consider the Column "Sign" also with the Amount.
  Here is my GridView's Source Code:</p>
  
  <pre><code> &lt;Columns&gt; 
    &lt;asp:BoundField DataField="ID" HeaderText="ID"/&gt;
         &lt;asp:TemplateField HeaderText="Sign" &gt;
          &lt;ItemTemplate&gt;
   &lt;asp:TextBox ID="txtgvSign" runat="server" Text='&lt;%# Bind("Sign") %&gt;'&gt;&lt;/asp:TextBox&gt;
  &lt;/ItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
   &lt;asp:TemplateField HeaderText="Amount"&gt;
    &lt;ItemTemplate&gt;
   &lt;asp:TextBox ID="txtAmount" runat="server" Text='&lt;%# Bind("Amount") %&gt;'&gt;&lt;/asp:TextBox&gt;  
  &lt;/ItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  &lt;/Columns&gt; 
  </code></pre>
  
  <p>So far, I have written One JavaScript, But It Only Calculate the Sum of Amount. I dont know how to calculate the Sum based on the Sign values. Below is the JavaScript I have written:</p>
  
  <pre><code>  function CalculateTax(fixedtotal)
    {
      var taxgrid = document.getElementById('&lt;%=gvAttribute.ClientID %&gt;');
      var taxip = taxgrid.getElementsByTagName('input');
      var taxamount = 0*1;
  
      for(i = 0; i &lt; taxip.length; i++)
      {
          var tax = taxip[i].value;            
          taxamount = parseFloat(taxamount) + parseFloat(tax);
      }
      return parseFloat(fixedtotal) + parseFloat(taxamount);
    }
  </code></pre>
  
  <p>So Please Make Changes to this Javascript.</p>