Requirements |
|
RadControls version |
2009.3.1314 |
.NET version |
ALL |
Visual Studio version |
ALL |
programming language |
C# |
browser support |
all browsers supported by RadControls |
PROJECT DESCRIPTION
The following event handler will add headers and ids to the output of a radGrid. For Section 508 accessibility there are several methods (because accessibility browsers do different implementation). This implements one of these methods. It may co-exist with the scope pattern to cover more accessibility browsers.
static void grid_ItemCreatedAddIdHeader(object sender, GridItemEventArgs e) |
{ |
var colno = 1; |
if (e.Item is GridHeaderItem) |
{ |
colno = 1; |
GridHeaderItem headItem = e.Item as GridHeaderItem; |
foreach (GridColumn col in headItem.OwnerTableView.Columns) |
{ |
TableCell cell = headItem[col.UniqueName]; |
cell.Attributes["id"] = string.Format(CultureInfo.CurrentCulture, "header{0}", colno); ; |
colno++; |
} |
} |
if (e.Item is GridDataItem) |
{ |
// Add headers alternative to grid |
colno = 1; |
foreach (GridColumn col in dataItem.OwnerTableView.Columns) |
{ |
TableCell cell = dataItem[col.UniqueName]; |
cell.Attributes["headers"] = string.Format(CultureInfo.CurrentCulture, "header{0}", colno); ; |
colno++; |
} |
} |
} |