title: ASP.NET Gridview button onclick not firing
body: <p>Hi all I have a simpe ASP button inside a grid. But the onclick event doesn't seem to fire. Where did I go wrong?</p>
  
  <p>Here's the first line of my aspx page.</p>
  
  <pre><code>&lt;%@ Page Title="Trainer Data" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeFile="TrainerData.aspx.vb" Inherits="TrainerData"%&gt;
  </code></pre>
  
  <p>And the button inside my gridview..</p>
  
  <pre><code>&lt;asp:GridView ID ="gvExecSummary" runat="server" CssClass="gridview" AllowSorting="false" AllowPaging="false" AutoGenerateColumns="false" Width="98%" &gt;
  &lt;RowStyle Height="22px" /&gt;
  &lt;AlternatingRowStyle Height="22px" CssClass="bg" BackColor="LightGray"/&gt;
  &lt;HeaderStyle Height="22px" BackColor="#4b6c9e" Font-Bold="true"/&gt;
  &lt;Columns&gt;
  &lt;asp:TemplateField  HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="5%" HeaderText="Action"&gt;
  &lt;ItemTemplate&gt;
  &lt;asp:Button ID="btnExecutiveGenerate" runat="server" Text="Generate"     OnClientClick="btnExecutiveGenerate_Click" /&gt;
  &lt;/ItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>P.S. I tried even onclick but it doesn't work either.</p>
  
  <p>EDIT: My code for server side.</p>
  
  <pre><code>Protected Sub btnExecutiveGenerate_Click(sender As Object, e As EventArgs)
      Dim gvrow As GridViewRow = CType(CType(sender, Control).Parent.Parent, GridViewRow)
      Dim lblSchoolId As System.Web.UI.WebControls.Label = gvrow.FindControl("lblSchoolMasterID")
      Dim lblFacultyId As System.Web.UI.WebControls.Label = gvrow.FindControl("lblFacultyMasterID")
      Dim btnExecutiveGenerate As System.Web.UI.WebControls.Button = gvrow.FindControl("btnExecutiveGenerate")
  
      PDF_Creation_Executive(Val(lblSchoolId.Text), Val(lblFacultyId.Text))
  
  End Sub
  </code></pre>