title: How to find label text within clicked row of a Gridview using jquery
body: <p>I'm trying to find the text of a label within row of an asp.net grid view when anywhere on the row is clicked. I have the gridview shown below with the jquery I'm using underneath. I'm getting a javascript alert box when I click on the row, just no text. What am I doing wrong?</p>
  
  <pre><code> &lt;asp:GridView runat="server" ID="grvAgents" AutoGenerateColumns="False" OnRowDataBound="grvAgents_OnRowDataBound"
                      CssClass="table table-bordered table-striped" AlternatingRowStyle-CssClass="even"
                      ClientIDMode="Static"&gt;
                      &lt;AlternatingRowStyle CssClass="even" /&gt;
                      &lt;Columns&gt;                       
                          &lt;asp:TemplateField HeaderText="Site" Visible="false"&gt;
                              &lt;ItemTemplate&gt;
                                  &lt;asp:Label ID="lblSite" CssClass="siteLbl" runat="server" Text='&lt;%#Eval("Site") %&gt;' ClientIDMode="Static"&gt;&lt;/asp:Label&gt;
                              &lt;/ItemTemplate&gt;
                          &lt;/asp:TemplateField&gt;
                      &lt;/Columns&gt;
                  &lt;/asp:GridView&gt;
  
      &lt;script type="text/javascript"&gt;
              function BindEvents() {
                  $(document).ready(function (e) {
                      $('#grvAgents tr').click(function () {
                          var tr = $(this).closest('tr');
                          var lbl = tr.find('.siteLbl').text();
                          alert(lbl);
                          //                  
  
                  });
                  });
              }       
  
          &lt;/script&gt;
  </code></pre>