title: Dynamically adding and removing columns from asp.net Gridview
body: <p>I have a gridview with fixed number of columns in it, but i want to make the columns dynamic that is number of columns should vary based on the selected option`</p>
  
  <pre><code>&lt;asp:GridView ID="grid_additional_test" CssClass="table table-condensed table-striped hover table-bordered static pull-left table-hover"
  runat="server" AutoGenerateColumns="False" Width="200px" OnRowDataBound="grid_additional_test_RowDataBound"&gt;
  &lt;Columns&gt;
  &lt;asp:BoundField HeaderText="Test Code" DataField="Test_Code"&gt;
  &lt;HeaderStyle HorizontalAlign="Center" Width="20%" /&gt;
  &lt;ItemStyle Width="15%" CssClass="colL fix_gv_clm" HorizontalAlign="Left" /&gt;
  &lt;HeaderStyle CssClass="fix_gv_clm" /&gt;
  &lt;/asp:BoundField&gt;
  &lt;/Columns&gt;
  &lt;HeaderStyle BackColor="#F2F2F2" /&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>`
  Here's my code behind to bind the data:</p>
  
  <pre><code>grid_additional_test.DataSource = ds.Tables[0];
          grid_additional_test.DataBind();
          grid_additional_test.Visible = true;
  </code></pre>
  
  <p>Please share your insights on it.</p>