title: How to find control on GridView RowCommand Event?
body: <p>i tried something like this but did not work:</p>
  
  <pre><code>GridViewRow row = (GridViewRow)(((Repeater)e.CommandSource).NamingContainer); 
  Repeater _rpt1 = row.Cells[8].FindControl("rptReg") as Repeater;
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>Unable to cast object of type 'System.Web.UI.WebControls.Button' to type 'System.Web.UI.WebControls.Repeater'.
  </code></pre>
  
  <p>is there a way i can have the below code in <code>OnRowCommand</code> event using GridView?</p>
  
  <p>actually i am trying to delete the row from the gridview control and when the user click on it and i am grabbing the mulitple ids and passing to SP and update the table and <code>databind the gridview</code></p>
  
  <pre><code>GridViewRow row = gv.SelectedRow;           
      Repeater _rpt = gv.Rows[e.RowIndex].Cells[8].FindControl("rptReg") as Repeater;
      Repeater _rpt1 = gv.Rows[e.RowIndex].Cells[9].FindControl("rptVisitor") as Repeater;
  
      foreach (RepeaterItem item in _rpt.Items)
      {
          TextBox _txt = item.FindControl("txtId") as TextBox;
          TextBox _txt1 = item.FindControl("txtName") as TextBox;
          //update db
      }
  </code></pre>