title: How to Get GridView Row Values on ButtonClick using Javascript in asp.net?
body: <p>I have a <code>GridView</code> in my <code>asp.net</code> Applicaiton. i have a <code>Button</code> with <code>javascript</code> function which shows the values of <code>selected</code> row in <code>Div</code>. How to get all <code>Grid</code> <code>Column values of Selected Row on ButtonClick</code>.</p>
  
  <p><img src="https://i.stack.imgur.com/tO2rO.png" alt="enter image description here">
  Javascript:</p>
  
  <pre><code>function SetRowValues(id, controlid, fair, good, mint, nnew, poor,broken) {
              //alert(id + " " + fair + " " + controlid);
              $("#divSelectedRow").html("TPCCID: " + id + " Fair:" + fair + " Good: " + good + " Mint: " + mint + " New: " + nnew + " Poor: " + poor + " Broken: " + broken);
              $("#divSelectedRow").css("display", "block");
              return false;
      }
  </code></pre>
  
  <p>Grid Markup:</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText="Source" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center"
      HeaderStyle-HorizontalAlign="Center"&gt;
      &lt;ItemTemplate&gt;
   &lt;asp:Button ID="BtnSource" runat="server" CausesValidation="false" OnClick='&lt;%# "return SetRowValues("+Eval("ttppcid")+",this.id,"+Eval("Fair")+","+Eval("Good")+","+Eval("Mint")+","+Eval("Poor")+","+Eval("Broken")+")"%&gt;' Text="Source" /&gt;
    &lt;/ItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>Here, i want to get all the column values of <code>selected row</code> using <code>Javascript</code>. 
  <strong>Note</strong>: When the Value for column1 is string containing Space eg: "Cell Phone" then the script wont work.
  Please help me to get the entire <code>row</code> values using <code>javascript</code> on <code>Button Click</code>.</p>
  
  <p>Help Appreciated!</p>