Thursday, March 28, 2013

How to generate from GridView ?




http://www.dotnetcurry.com/ShowArticle.aspx?ID=250
In order to prevent the Column Header to be highlighted, use the following code to generate the <thead>:
C#
if (GridView1.Rows.Count > 0)
{
GridView1.UseAccessibleHeader = true;
GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;
//GridView1.FooterRow.TableSection = TableRowSection.TableFooter;
}
VB.NET
If GridView1.Rows.Count > 0 Then
GridView1.UseAccessibleHeader = True
GridView1.HeaderRow.TableSection = TableRowSection.TableHeader
'GridView1.FooterRow.TableSection = TableRowSection.TableFooter;
End If
The code above generates the <thead> tag for us instead of generating the <th> in the <tr> (which is the default html generated). I have on purpose commented out the FooterRow code, since it gives me a strange error. I have used a second approach to solve that to a certain extent. Read on.


No comments:

Post a Comment

 using Microsoft.AspNetCore.Mvc; using System.Xml.Linq; using System.Xml.XPath; //<table class="common-table medium js-table js-stre...