title: Pass GridView column value to Javascript function - OnClientClick
body: <p>I have a grid view like this:</p>
  
  <pre><code>&lt;asp:SqlDataSource ID="SqlPersistentOffenders" runat="server"&gt;&lt;/asp:SqlDataSource&gt;
      &lt;asp:GridView ID="GVPersistentOffenders" runat="server" DataSourceID="SqlPersistentOffenders" AllowPaging="true" AutoGenerateColumns="false"&gt;
      &lt;Columns&gt;
          &lt;asp:TemplateField HeaderText="PersonID" Visible="false"&gt;
              &lt;ItemTemplate&gt;
                   &lt;asp:Label ID="LabCreUser" runat="server" Text='&lt;%# Bind("creUser")%&gt;'&gt;&lt;/asp:Label&gt;                       
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
           &lt;asp:TemplateField&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Button ID="ButtonSendEmail" runat="server" CommandName="SendEmail" CommandArgument="&lt;%# CType(Container,GridViewRow).RowIndex %&gt;" Text="Send Email" OnClientClick="GetEmailAddress()"/&gt;                     
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>The JavaScript looks like this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          function GetEmailAddress(creuser) {
             //Do something
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>How can I pass the value in LabCreUser for the row selected to the Javasript function?</p>
  
  <p>I have looked here: <a href="https://stackoverflow.com/questions/12850327/passing-variables-to-javascript-in-onclientclick">Passing variables to javascript in onclientclick</a> and also a few other questions.  Nothing I have tried has worked.</p>