Why am I am getting an extra line in GridView with the following text in the
1st column: "System.Web.UI.WebControls.TableRow"
Here's partial listing of my code:
..................
grid.DataSource = loadTable(ds);
grid.DataBind();
.................
private DataTable loadTable(DataSet ds)
{
DataTable dt = new DataTable();
DataTable myDataTable = ds.Tables[1];
int cols = myDataTable.Columns.Count;
TableHeaderRow thr = new TableHeaderRow();
for(int i = 0; i < cols; i++)
{
TableHeaderCell thc = new TableHeaderCell();
thc.Text = myDataTable.Columns[i].ColumnName;
thr.Cells.Add(thc);
DataColumn dcol = new DataColumn(thc.Text,
typeof(System.String));
dt.Columns.Add(dcol);
}
dt.Rows.Add(thr);
return dt;
}
Alvin Bruney [MVP] - 20 Apr 2007 12:46 GMT
It's most likely an empty row.

Signature
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
> Why am I am getting an extra line in GridView with the following text in
> the 1st column: "System.Web.UI.WebControls.TableRow"
[quoted text clipped - 24 lines]
> return dt;
> }