Showing posts with label Gridview. Show all posts
Showing posts with label Gridview. Show all posts

Wednesday, 19 March 2014

Asp Gridview Render the header row as thead and tbody

Asp Gridview Render the header row as thead and tbody:

Description:

                When setting the property UseAccessibleHeader = true, it replaces the<td> elements of the header row with the correct <th> which means table header. It also adds the scope property of these header elements making them more accessible.

C# code:

      //This replaces <td> with <th> and adds the scope attribute
      gvtabledetails.UseAccessibleHeader = true;

      //This will add the <thead> and <tbody> elements
      gvtabledetails.HeaderRow.TableSection = TableRowSection.TableHeader;

      //This adds the <tfoot> element. Remove if you don't have a footer row 
      gvtabledetails.FooterRow.TableSection = TableRowSection.TableFooter;

Reference Link:

http://madskristensen.net/post/make-the-gridview-control-accessible