title: using OnRowCommand of the GridView in asp.net
body: <p>i created a web application wherein i used the onrowcommand and created the handler in code behind, now i have a button inside the emptytemplate, whenever i click the button, my onRowCommand is not executed. Below is my code.</p>
  
  <pre><code>&lt;asp:GridView ID="grdExternalLinkSection1" runat="server" Width="100%" AutoGenerateColumns="false" CellPadding="5" OnRowCommand="grdExternalLinkSection_RowCommand"&gt;
                                  &lt;EmptyDataTemplate&gt;
                                      External Link Title
                                      &lt;asp:TextBox ID="txtExternalLinkTitleEmptySection1" runat="server"&gt;&lt;/asp:TextBox&gt;
                                      External Link Url
                                      &lt;asp:TextBox ID="txtExternalLinkUrlEmptySection1" runat="server"&gt;&lt;/asp:TextBox&gt;
                                      &lt;asp:Button ID="btnExternalLinkEmptySection1" runat="server" Text="Add" CommandArgument="1" CommandName="headernew" style="padding:3px; width:56px;" /&gt;
                                  &lt;/EmptyDataTemplate&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>there are more fields but this is what i am talking about. and here is my code behind handler for the RowCommand Event.</p>
  
  <pre><code>protected void grdExternalLinkSection_RowCommand(object sender, GridViewCommandEventArgs e)
      {
          Response.Write("welcome");
      }
  </code></pre>
  
  <p>it never excutes the handler, and below is my page directive:</p>
  
  <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="NewsletterASPVersion.ascx.cs" Inherits="RWO_Controls_NewsletterASPVersion" %&gt;
  </code></pre>
  
  <p>this worked once, and after thereafter never working. does anyone have any idea what could be causing this.</p>