title: How to hide GridView Coumn[1]?
body: <p>I am trying to hide the gridview coumn[1]. But it shows error like </p>
  
  <pre><code>Index was out of range. Must be non-negative and less than the size of
  the collection parameter name:index.
  </code></pre>
  
  <p>How can I perform this. I surfed a lot in internet but I didnt get a proper solution. My code I mentioned below.It is a web based platform. </p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
   {
     if (!IsPostBack)
       {
        qry = "select Id,Name,Age,Sex,Dob from Sample where Code='123';
        dr = conn.query(qry);
        GridView1.DataSource = dr;
        GridView1.DataBind();
        GridView1.Columns[1].Visible = false;
        }
   }
  </code></pre>
  
  <p>In this same way column[0] is hiding.
  My grid view is</p>
  
  <pre><code> &lt;asp:GridView ID="GridView1" HorizontalAlign="Center" runat="server" 
        onrowcommand="GridView1_RowCommand"&gt;
      &lt;Columns&gt;
         &lt;asp:TemplateField&gt;
            &lt;ItemTemplate&gt;
               &lt;asp:LinkButton ID="LinkButton1" runat="server"
                     CommandArgument='&lt;%# Eval("ID")%&gt;'&gt;Delete&lt;/asp:LinkButton&gt;
               &lt;/ItemTemplate&gt;
           &lt;/asp:TemplateField&gt;
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>