OnRowCommand in grid is not firing?
<p>I am working after a long time in grid and facing an issue.</p>

<p>In grid there are TemplateFields having linkbutton for edit and delete. OnRowCommand event is not firing in gird. An important point is that if I autogenerate Edit or Delete buttons its RowCommand event fires.</p>

<p>Here is my aspx code:</p>

<pre><code> &lt;asp:GridView ID="gvContact" runat="server" AllowPaging="True" AllowSorting="True"
        DataKeyNames="MailId" AutoGenerateColumns="False" CssClass="ContactsGridViewStyle"
        GridLines="None" OnRowEditing="gv_RowEdit" OnRowDataBound="gv_RowDataBound" OnRowCancelingEdit="gv_CancellingEdit"
        OnRowUpdating="gv_RowUpdating" Width="600px" OnPageIndexChanging="gv_PageChanging"
        OnRowCommand="gv_RowCommand" EmptyDataText="No Record found" EmptyDataRowStyle-ForeColor="Red"
        EmptyDataRowStyle-HorizontalAlign="Center"&gt;
        &lt;RowStyle CssClass="RowStyle" /&gt;
        &lt;EmptyDataRowStyle CssClass="EmptyRowStyle" /&gt;
        &lt;PagerStyle CssClass="PagerStyle" /&gt;
        &lt;SelectedRowStyle CssClass="SelectedRowStyle" /&gt;
        &lt;HeaderStyle CssClass="HeaderStyle" /&gt;
        &lt;EditRowStyle CssClass="EditRowStyle" /&gt;
        &lt;AlternatingRowStyle CssClass="AltRowStyle" /&gt;
        &lt;Columns&gt;
        &lt;asp:TemplateField HeaderText="Name"&gt;
                &lt;EditItemTemplate&gt;
                    &lt;asp:TextBox ID="txtName" runat="server" Text='&lt;%# Bind("Name") %&gt;'&gt;&lt;/asp:TextBox&gt;&lt;br /&gt;
                    &lt;asp:RequiredFieldValidator runat="server" ID="rfvName" ControlToValidate="txtName"
                        Display="Dynamic" Text="Name is a required field"&gt;&lt;/asp:RequiredFieldValidator&gt;
                &lt;/EditItemTemplate&gt;
                &lt;ItemTemplate&gt;
                    &lt;asp:Label ID="lblName" runat="server" Text='&lt;%# Bind("Name") %&gt;'&gt;&lt;/asp:Label&gt;
                &lt;/ItemTemplate&gt;
            &lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField HeaderText="Email Id"&gt;
                &lt;EditItemTemplate&gt;
                    &lt;asp:TextBox ID="txtMessageTo" runat="server" Text='&lt;%# Bind("MessageTo") %&gt;'&gt;&lt;/asp:TextBox&gt;&lt;br /&gt;
                    &lt;asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator2" ControlToValidate="txtMessageTo"
                        Display="Dynamic" Text="Email is a required field"&gt;&lt;/asp:RequiredFieldValidator&gt;
                    &lt;asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" Display="Dynamic"
                        Text="Email address is Invalid" SetFocusOnError="true" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                        ControlToValidate="txtMessageTo"&gt;                    
                    &lt;/asp:RegularExpressionValidator&gt;
                &lt;/EditItemTemplate&gt;
                &lt;ItemTemplate&gt;
                    &lt;asp:Label ID="lblMessageTo" runat="server" Text='&lt;%# Bind("MessageTo") %&gt;'&gt;&lt;/asp:Label&gt;
                &lt;/ItemTemplate&gt;
            &lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField&gt;
                &lt;ItemTemplate&gt;
                    &lt;asp:ImageButton runat="server" ID="ibtn" CommandArgument='&lt;%#Eval("RowId")%&gt;' CommandName="EEE"
                        ImageUrl="~/Images/cross.png" /&gt;
                    &lt;asp:LinkButton ID="lbtnEdit" runat="server" Text="Edit" CommandArgument='&lt;%# Eval("RowId")%&gt;'
                        CommandName="EE"&gt;&lt;/asp:LinkButton&gt;
                &lt;/ItemTemplate&gt;
                &lt;EditItemTemplate&gt;
                    &lt;asp:LinkButton runat="server" ID="lbtnUpdate" Text="Update" CommandName="UU"&gt;&lt;/asp:LinkButton&gt;
                    &lt;asp:LinkButton runat="server" ID="lbtnCancel" Text="Cancel" CommandName="CC"&gt;&lt;/asp:LinkButton&gt;
                &lt;/EditItemTemplate&gt;
            &lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField&gt;
                &lt;ItemTemplate&gt;
                    &lt;asp:LinkButton ID="lbtnDelete" runat="server" Text="Delete" CommandArgument='&lt;%# Eval("RowId")%&gt;'
                        CommandName="DD"&gt;&lt;/asp:LinkButton&gt;
                &lt;/ItemTemplate&gt;
            &lt;/asp:TemplateField&gt;
        &lt;/Columns&gt;
    &lt;/asp:GridView&gt;
</code></pre>

<p>In CS file I am binding grid in !Page.IspostBack. </p>

<p>Any guidance please.</p>
