title: How do I get the selected row in Gridview in Javascript or JQuery
body: <p>Let me elaborate ... below is my partial gridview with a button field ... what I want is the text value of the button to use in building a url: </p>
  
  <pre><code>&lt;asp:GridView CssClass="gridUser" ID="UsersGrid" ClientIDMode="Static" runat="server" AllowPaging="true" AllowSorting="true" PageSize="5" OnPageIndexChanging="PageIndexChange" OnRowCommand="Paging" OnSorting="SortPage" OnRowCreated="RowCreated"
                  AutoGenerateColumns="false"&gt;
  
                  &lt;PagerSettings Mode="NextPreviousFirstLast" FirstPageImageUrl="~/Images/Navigation/firstpageIcon.png" LastPageImageUrl="~/Images/Navigation/lastpageIcon.png"
                      NextPageImageUrl="~/Images/Navigation/forwardOneIcon.png" PreviousPageImageUrl="~/Images/Navigation/backOneIcon.png" Position="Bottom" /&gt;
  
                  &lt;Columns&gt;
                      &lt;asp:TemplateField HeaderText="User Name" HeaderStyle-CssClass="gridHeader"&gt;
                          &lt;ItemTemplate&gt;
                             &lt;asp:Button ID="UserLink" ClientIDMode="Static" runat="server" Text='&lt;%#Eval("UserName") %&gt;' CssClass="linkButton" OnClientClick = "return GetSelectedRow(this)"&gt;&lt;/asp:Button&gt;
                      &lt;/ItemTemplate&gt;
                          &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>and here is my javascript : </p>
  
  <pre><code> $(".linkButton").click(function () {
          var ul = document.getElementById('UserLink');
          var row = ul.parentNode.parentNode;
          var rowIndex = row.rowIndex - 1;
          var Userid = row.cells[0].childNodes[1].value;
          var User = Userid;
          alert("Row is : " + row + "RowIndex is : " + rowIndex + "User ID is " + User);
      });
  </code></pre>
  
  <p>My issue is that my row returned is the first row ... not the selected row ... how do I get the selected row? Thank you for any assistance.</p>