title: Make panel visible inside inside gridview control in asp.net c#
body: <p>I have written like below lines of code</p>
  
  <p>in aspx file </p>
  
  <pre><code>     &lt;asp:TemplateField HeaderText="Is Active"&gt;
                    &lt;ItemTemplate&gt;            
        &lt;asp:LinkButton ID="lnkEdit" CssClass="colorlnkbtnedit" runat="server" ToolTip="Edit" CommandArgument='&lt;%# DataBinder.Eval (Container.DataItem, "ProductDocument") %&gt;'
                     CommandName="EditIsActive"&gt;&lt;i class=" icon-pencil"&gt;&lt;/i&gt;      &lt;/asp:LinkButton&gt;
  
                    &lt;asp:Panel ID="pnlIsActEdit" runat="server" Visible="false"&gt;  
    ...
    ...
           &lt;/asp:Panel&gt;
  
                    &lt;/ItemTemplate&gt;
                    &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>in .cs file</p>
  
  <pre><code>    protected void gvProductView_RowCommand(object sender, GridViewCommandEventArgs e)
      {
          if (e.CommandName == "Download")
          {
           ...
           ... 
          }
       else if (e.CommandName == "EditIsActive")
          {
              int rowID = Convert.ToInt32(e.CommandArgument);
              GridViewRow r = gvProductView.Rows[rowID]; 
  
              Panel p = (Panel)r.FindControl("pnlIsActEdit");
              p.Visible = false;
          }
       }
  </code></pre>
  
  <p>It's not working !!! It throws <code>"Index was out of range. Must be non-negative and less than the size of the collection"</code>
   error message at   <code>GridViewRow r = gvProductView.Rows[rowID];</code> line of code.</p>