On asp:Table Control how do we create a thead ?
- by balexandre
from MSDN article on the subject we can see that we create a TableHeaderRowthat conatins TableHeaderCells.
but they add the table header like this:
myTable.Row.AddAt(0, headerRow);
witch outputs the HTML:
<table id="Table1" ... >
<tr>
<th scope="column" abbr="Col 1 Head">Column 1 Header</th>
<th scope="column" abbr="Col 2 Head">Column 2 Header</th>
<th scope="column" abbr="Col 3 Head">Column 3 Header</th>
</tr>
<tr>
<td>(0,0)</td>
<td>(0,1)</td>
<td>(0,2)</td>
</tr>
...
and it should have <thead> and <tbody> (so it works seamless with tablesorter) :)
<table id="Table1" ... >
<thead>
<tr>
<th scope="column" abbr="Col 1 Head">Column 1 Header</th>
<th scope="column" abbr="Col 2 Head">Column 2 Header</th>
<th scope="column" abbr="Col 3 Head">Column 3 Header</th>
</tr>
</thead>
<tbody>
<tr>
<td>(0,0)</td>
<td>(0,1)</td>
<td>(0,2)</td>
</tr>
...
</tbody>
the HTML aspx code is
<asp:Table ID="Table1" runat="server" />
How can I output the correct syntax?
Just as information, the GridViewcontrol has this builed in as we just need to set teh Accesbility and use the HeaderRow
gv.UseAccessibleHeader = true;
gv.HeaderRow.TableSection = TableRowSection.TableHeader;
gv.HeaderRow.CssClass = "myclass";
but the question is for the Table control.