I specifically need thead tags in my program. When I use System.Web.UI.WebControls;
it outputs header rows as <tr>
tags instead of <thead>
tags. Is there a way to change this so that it says <thead>
?
StringWriter sw = new StringWriter();
HtmlTextWriter w = new HtmlTextWriter(sw);
Table tbl = new Table();
TableHeaderRow thr = new TableHeaderRow();
foreach (DataColumn col in dt.Columns)
{
TableCell th = new TableCell();
th.Text = col.Caption;
th.ID = "cellSize";
thr.Controls.Add(th);
}
tbl.Controls.Add(thr);
tbl.RenderControl(w);
tableString = sw.ToString();
This outputs a row like <tr><td></td></tr>