title: How to get value from GridView cell with Javascript
body: <p>I'm trying to get a value from a <code>GridView</code> cell to change the source of an embed PDF. I execute a function when a button that is placed on each row of the <code>GridView</code> is clicked.</p>
  
  <p>This is the code I have so far:</p>
  
  <pre><code>&lt;script&gt;
  
      function changepdf(pdf) {
  
          var value = document.getElementById('&lt;%= GridView1.ClientID %&gt;').rows[pdf.rowIndex].cells[3].innerText;
          var file = document.getElementById('pdf');
          file.src = 'pdf/catalogosh.pdf#page=' + value + '&amp;#toolbar=0&amp;#view=fit';
          return false;
      }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>The Javascript function works fine when I write exactly the new source like this:</p>
  
  <pre><code>&lt;script&gt;
  
      function changepdf(pdf) {
  
          var file = document.getElementById('pdf');
          file.src = 'pdf/catalogosh.pdf#page=4&amp;#toolbar=0&amp;#view=fit';
          return false;
      }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>The main idea is to change the PDF page taking the value from de <code>GridView</code>.</p>
  
  <p>Thanks in advance for any help.</p>