title: Pass GridView Template Field <asp:LinkButton control data to javascript function in my .aspx page
body: <p>I have a GridView Template field containing an ASP:Label field which has a unique reference number per Row. I also have an open Javascript function assigned to that control which opens a URL in a new window and displays the document of the same reference number.</p>
  
  <p>I don;t know how to obtain the reference number when the user clicks the LinkButton on a particular row, and pass it to my Javascript function before the window opens.</p>
  
  <p>Code:</p>
  
  <pre><code>enter code here
  
  function openPreview() 
  {
       var url = "quotereport.aspx?view=esq&amp;&amp;ref=REFNUMBER"; window.open(url);
  }
  
  &lt;asp:TemplateField HeaderText="" ShowHeader="False"&gt;
      &lt;ItemTemplate&gt;
      &lt;asp:LinkButton ID="lbNewWindow" runat="server" OnClientClick="openPreview    ()"&gt;Window&lt;/asp:LinkButton&gt;
  &lt;/ItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>Any help would be much appreciated.</p>