title: How to hide column in GridView after DataBind?
body: <p>I ask this question because I think I have different problem with this : <a href="https://stackoverflow.com/questions/12806794/how-to-hide-gridview-column-after-databind">How to hide gridview column after databind?</a></p>
  
  <p>My gridview has data from database. I don't set any "td" in my code, but html changes the gridview to table and have "td". The problem is, I don't want the cell or "td" is shown on the page, I just want to receive the data in the cell to show the image in the database.</p>
  
  <p>This is code to retrieve data from database:</p>
  
  <pre><code>   public static DataTable FetchAllImagesInfo(int id)
     {
       string sb = "Select img_content, Img_id, csrid FROM images WHERE Img_Id = " + id + ";";
       SqlConnection conn = DatabaseFactory.GetConnection();
       SqlDataAdapter da = new SqlDataAdapter(sb, conn);
       DataTable dt = new DataTable();
       da.Fill(dt);
       return dt;
      }
  </code></pre>
  
  <p>This is codebehind to bind GridView, here I tried to set Visible to true or false, but it doesn't work. I set column index manually because it's only has 3 column :</p>
  
  <pre><code>GridView1.DataSource = ProductAllLocationCatalog.FetchAllImagesInfo(_id);
  GridView1.DataBind();
  GridView1.Columns[0].Visible = true;
  GridView1.Columns[1].Visible = false;
  GridView1.Columns[2].Visible = false;
  </code></pre>
  
  <p>And, this is my aspx code :</p>
  
  <pre><code>&lt;asp:GridView ID="GridView1" runat="server"&gt;
    &lt;Columns&gt;
      &lt;asp:TemplateField runat="server"&gt;
         &lt;ItemTemplate runat="server"&gt;
            &lt;asp:Image ID="image1" runat="server" ImageUrl='&lt;%#"Handler.ashx?csrid="+Eval("csrid") %&gt;' style="max-height:400px; max-width:940px; text-align:center; margin:auto; display:block;" /&gt;
         &lt;/ItemTemplate&gt;
       &lt;/asp:TemplateField&gt;
    &lt;/Columns&gt;
  &lt;/asp:GridView&gt;   
  </code></pre>
  
  <p>I just need the image from the database, not other. But if I only SELECT the image, gridview can not do DataBind(), and I can't get value of "csrid".</p>
  
  <p>Thank you!</p>