title: How to assign a text value to a label in a gridview on button click using Javascript?
body: <p>I am trying to assign a value to a label in a gridview on button click. For some reason, my code below does not seem to work.</p>
  
  <p>Gridview cell that should be changed on click (the label should show "Pending"):</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText="Status"&gt;
       &lt;ItemTemplate&gt;
            &lt;asp:Label runat="server" ID="lblStatus" Text='&lt;%# Eval("Status") %&gt;' /&gt;        
       &lt;/ItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>Button that triggers the change:</p>
  
  <pre><code>&lt;asp:Button runat="server" id="btnUpdate" text="Update" OnClientClick="changeStat()" /&gt;
  </code></pre>
  
  <p>The javascript:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function changeStat() {
  
          var grid = document.getElementById("&lt;%=gvAUTSubscription.ClientID%&gt;");
  
          for (var j = 0; j &lt; grid.rows.length - 1; j++) {
              grid.rows[j].cells[3].children[0].innerText = "Pending";
          }
      }; 
  &lt;/script&gt;
  </code></pre>
  
  <p>Any help is appreciated. Thanks in advance! :)</p>