title: Grid View Row Command Event Not Working
body: <p>I am having GridView control inside Wizard control, and I am having a linkbutton inside grid, clicking on which will change active index of wizard.
  I have three GridViewControls and I am using same Event for RowCommand of these Grids, but its not working, I tried applying breakpoint but its not hitting the break point.
  This is my code</p>
  
  <pre><code>w ID="GVUsers" runat="server" OnRowDataBound="GVUsers_RowDataBound" OnRowCommand="GVUsers_RowCommand" 
      OnRowDeleting="GVUsers_RowDeleting" AutoGenerateColumns="false" CssClass="table"&gt;
      &lt;Columns&gt;
              &lt;asp:TemplateField HeaderText="Crimes" ItemStyle-HorizontalAlign="Left"&gt;
                  &lt;ItemTemplate&gt;
                      &lt;asp:Label ID="Username" runat="server" Text='&lt;%#DataBinder.Eval(Container.DataItem, "Username") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;asp:Label ID="gender" runat="server" Text='&lt;%#DataBinder.Eval(Container.DataItem, "Gender") %&gt;'&gt;&lt;/asp:Label&gt;                                   
                      &lt;asp:Panel ID="divmsg" runat="server"&gt;
                          &lt;asp:LinkButton
                              ID="btnlnkpg18" runat="server" Text="Click here" CommandName="pg18"&gt;&lt;/asp:LinkButton&gt;
                      &lt;/asp:Panel&gt;
                  &lt;/ItemTemplate&gt;
                   &lt;asp:TemplateField&gt;
                      &lt;asp:TemplateField HeaderText="Delete" ItemStyle-HorizontalAlign="Left"&gt;
                  &lt;ItemTemplate&gt;
                       &lt;asp:LinkButton ID="delbtn" runat="server" Text="Delete" OnClientClick="return confirm('Do you really want to delete?');"
                          CommandName="delete" CommandArgument='&lt;%#DataBinder.Eval(Container.DataItem, "UserId") %&gt;'
                          CssClass="DeleteBtn"&gt;&lt;/asp:LinkButton&gt;
                  &lt;/ItemTemplate&gt;
               &lt;asp:TemplateField&gt;
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  
  protected void GVUsers_RowDataBound(object sender, GridViewRowEventArgs e)
  {
      if (e.Row.RowType == DataControlRowType.DataRow)
      {
          DataRow row = ((DataRowView)e.Row.DataItem).Row;
          var lblgender= e.Row.FindControl("gender") as Label;
          var divlnk=e.Row.FindControl("divmsg") as Panel;
  
          if(lblgender.Text=="M")         
              divlink.Visible=true;               
          else
              divlink.Visible=false;          
      }
  }
  
  protected void GVUsers_RowCommand(Object sender, GridViewCommandEventArgs e)
  {
      if (e.CommandName == "delete")
      {              
              //Delete
      }
  
      if (e.CommandName == "pg18")
      {
              Wizard1.ActiveStepIndex = 16;
      }
  }
  </code></pre>
  
  <p>I also tried setting CommandName in RowDataBound but no luck, Also the Delete Button is not working.
  I am databinding GridView like this</p>
  
  <pre><code>if(!Page.IsPostBack)
  {
  //Bind GridView
  }
  </code></pre>