How do I get Gridview to render THEAD?
How do I get the GridView
control to render the <thead>
<tbody>
tags? I know .UseAccessibleHeaders
makes it put <th>
instead of <td>
, but I cant get the <thead>
to appear.
Solution 1:
This should do it:
gv.HeaderRow.TableSection = TableRowSection.TableHeader;
Solution 2:
I use this in OnRowDataBound
event:
protected void GridViewResults_OnRowDataBound(object sender, GridViewRowEventArgs e) {
if (e.Row.RowType == DataControlRowType.Header) {
e.Row.TableSection = TableRowSection.TableHeader;
}
}