C#, Delete first row from gridview element
<p>This has been asked many times, but I can't seem to find a direct answer.</p>

<p>Using C#, I use a datatable to fill a gridview. The first row of my datatable contains the table headers, so I loop through that row and fill the gridview header row. But now I need to get rid of that first row (the header row) in the table. I've looked all over, and all sources agree that the correct syntax is:</p>

<pre><code>   strSQL = "SELECT * FROM [Station ID Request$]";
   OleDbDataAdapter adaBatch = new OleDbDataAdapter(strSQL, strConnExcel);
   DataTable dtBatch = new DataTable();
   adaBatch.Fill(dtBatch);
   gv_stations.DataSource = dtBatch;
   gv_stations.DataBind();
   //  Fill gridview headers with first row of data (spreadsheet headers)
   int i = 0;
   foreach (DataColumn col in dtBatch.Columns)
   {
       gv_stations.HeaderRow.Cells[i].Text = dtBatch.Rows[0][i].ToString();
       i++;
   }
   //  Remove the first line of the gridview (contains header info)
   gv_stations.DeleteRow(0);
</code></pre>

<p>Everything works but the last line, which gives me this error:</p>

<pre><code>System.Web.HttpException (0x80004005): The GridView 'gv_stations' fired
event RowDeleting which wasn't handled. at
System.Web.UI.WebControls.GridView.OnRowDeleting(GridViewDeleteEventArgs e)
at System.Web.UI.WebControls.GridView.HandleDelete(GridViewRow row, Int32
rowIndex) at System.Web.UI.WebControls.GridView.DeleteRow(Int32 rowIndex) 
</code></pre>

<p>Every resource I've tried says that last line should be OK. Can anyone tell why I'm getting that error?</p>

<p>EDIT: Here is my gridview object, as requested.</p>

<pre><code>&lt;asp:GridView ID="gv_stations" runat="server"
    AutoGenerateColumns="True"    
    CssClass="c_gvv c_gvv_stations_results"
    style="white-space:nowrap;"&gt;
&lt;/asp:GridView&gt;
</code></pre>