ASP.NET 2.0 - DataGrid with tbody / thead
问题 Is there a way to get the DataGrid control to render the tbody and thead HTML elements? 回答1: While I like the answer by "user186197", that blog post uses reflection, things might go wrong in non-full-trusted hosting environments. Here's what we use, no hacks: public class THeadDataGrid : System.Web.UI.WebControls.DataGrid { protected override void OnPreRender(EventArgs e) { this.UseAccessibleHeader = true; //to make sure we render TH, not TD Table table = Controls[0] as Table; if (table !=