title: How to assign varible value to gridview textbox from javascript function
body: <p>I know this question is asking previously but i don't get any solution from that.</p>
  
  <p>I have grid-view and i want to calculate total amount and assign it in another textbox in same row. calculation is working perfect but i am unable to assign output value to next TextBox <code>Tol_Txt</code>.</p>
  
  <p>This is my JavaScript code:</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
              function CalculateTotal() {
                  var grid = document.getElementById("&lt;%= Grid_Delivery_Record.ClientID%&gt;");
  
                  for (var i = 0; i &lt; grid.rows.length - 1; i++) {
                      var rate = $("input[id*=Qty_Txt]");
                      var qty = $("input[id*=Rate_Txt]");
  
                      var totalamount = rate[i].value * qty[i].value; //--- Calculate totalamount fine
  
                      $("input[id*=Tol_Txt]") = totalamount[i].value;   //--- Unable to assign totalamount in Gridview TextBox
                      document.getElementById("Tol_Txt").value = totalamount;   //--also tried this
                      document.getElementById("Tol_Txt").innerHTML= totalamount;   //--also tried this
                  }
              }
          &lt;/script&gt;
  </code></pre>
  
  <p>This is my HTML code:</p>
  
  <pre><code>&lt;td&gt;
                          &lt;input name="ctl00$cphpagebody$Grid_Delivery_Record$ctl02$Qty_Txt" type="text" id="cphpagebody_Grid_Delivery_Record_Qty_Txt_0" OnKeyUp="CalculateTotal();" placeholder="Qty...." style="font-size:Small;" /&gt;
                      &lt;/td&gt;&lt;td&gt;
                          &lt;input name="ctl00$cphpagebody$Grid_Delivery_Record$ctl02$Rate_Txt" type="text" id="cphpagebody_Grid_Delivery_Record_Rate_Txt_0" OnKeyUp="CalculateTotal()" placeholder="Rate...." style="font-size:Small;" /&gt;
                      &lt;/td&gt;&lt;td&gt;
                          &lt;input name="ctl00$cphpagebody$Grid_Delivery_Record$ctl02$Tol_Txt" type="text" id="cphpagebody_Grid_Delivery_Record_Tol_Txt_0" style="font-size:Small;" /&gt;
                      &lt;/td&gt;
  </code></pre>
  
  <p>Thanks in advance.</p>