Extra line in GridView

J

John Doe

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.ColumnName;
thr.Cells.Add(thc);

DataColumn dcol = new DataColumn(thc.Text,
typeof(System.String));
dt.Columns.Add(dcol);
}
dt.Rows.Add(thr);
return dt;
}
 
A

Alvin Bruney [MVP]

It's most likely an empty row.

--
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top