How to force an asp.net GridView control to wrap the first line in <thead> </thead> tags
I want to use Christian Bach tableSort client table sorting a jQuery plugin with my asp.Net GridView.
But the problem is that in the documentation he writes:
tablesorter runs on standard HTML tables. You must include THEAD and TBODY Tags:
And unfortunately, asp.net only displays my GridView with tags and a title bar within the first row.
I tried:
dgvRate.HeaderRow.TableSection = TableRowSection.TableHeader;
after calling .DataBind ();
This helped to have an <TH></TH>inside header. But still inside<tbody>
Can I accomplish this, I mean moving the first line from <tbody></tbody>to <thead></thead>?
I do not want to add it manually at the PreRender stage; I am sure that this could be handled much easier, right?
thank
Sometimes you need to give it an accessible class to call this, for example:
protected void Page_Load(object sender, EventArgs e)
{
dgvRate.UseAccessibleHeader = true;
dgvRate.HeaderRow.TableSection = TableRowSection.TableHeader;
dgvRate.HeaderRow.CssClass = "headerclass";
}
Although for consistency of behavior in all cases, I would go along the PreRender route .