How to create thead and tbody in ASP.NET Table? I need those tags because of jquery and asp.net gives me only tr, th and td.
Frédéric's answer is not accurate. asp:Table DOES in fact support UseAccessibleHeader is true by default for tables, which means your header rows will be rendered properly with Here's my example asp:Table markup: At Page_Load, we specify that our TableHeaderRow1 should be a TableHeader: And finally, in your function that inserts rows into said table, you just have to specify that the TableRowSection of each row you add is a TableBody: You can do more reading on the TableRowSection property; looks like you can also accomplish this with your asp:Table template. and tags, but in a less obvious fashion than HtmlTable.
instead of , but to get the and tags, you've just got to set some voodoo at Page_Load and when you're creating/inserting your rows in the codebehind.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TableHeaderRow1.TableSection = TableRowSection.TableHeader
End Sub
Dim row As TableRow
Dim dvRow As Data.DataRowView
For Each dvRow In dv
row = New TableRow
row.TableSection = TableRowSection.TableBody 'THIS is the important bit
cell = New TableCell
Col1Stuff = New Label
Col1Stuff.Text = "Blah"
cell.Controls.Add(Col1Stuff)
row.Cells.Add(cell)
...
tblGeneral.Rows.Add(row)
Next