title: gridview button doesn't redirect in asp.net
body: <p>I have a button inside gridview and i am trying to redirect it to a page.
  The following is my code for the template view.</p>
  
  <pre><code>&lt;asp:TemplateField ShowHeader="False"&gt;
                &lt;ItemTemplate&gt;
                   &lt;asp:Button ID="btnView" runat="server" CausesValidation="false" OnClick="btnView_Click" Text="View" Font-Size="Small"&gt;&lt;/asp:Button&gt;
                &lt;/ItemTemplate&gt;
             &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>I tried the following solution for the OnClick.</p>
  
  <pre><code> protected void btnView_Click(object sender, EventArgs e)
  {
      Button btn = (Button)sender;
      GridViewRow row = (GridViewRow)btn.NamingContainer;
  
      Response.Redirect("Customer.aspx" );
  }
  </code></pre>
  
  <p>My code isn't working fro some reason and the button doesn't redirect. I looked at other solutions as well but I they are not working for me. Can someone please let me know what I am missing here. Thank you.</p>