This online example demonstrates how to create Section 508
compliant RadGrid. The paging and sorting features of the control are switched on by using pager template with asp Buttons and push buttons in the column headers. No client
features are enabled because one of the prerequisites for section 508 compliance is to ensure that your control operates normally with javascript execution disabled through the
browser options.
Covering this criterion is very important when you would like to make your components accessible to people with disabilities.
The Section 508 standards are listed on the official government site:
Section 508
Here are the code snippets from the aforementioned sample:
| ASPX/ASCX |
Copy Code |
|
<head runat="server">
<link type="text/css" rel="stylesheet" href="Skins/Sunset/Grid.Sunset.css" />
<style type="text/css">
.RadGrid_<%= MyGrid1.Skin
%> th input
{
border:0px;
background-color: Transparent;
font-weight:bold;
cursor: pointer;
color:White;
text-align:left;
}
.RadGrid_<%= MyGrid1.Skin %> th, .RadGrid_<%= MyGrid1.Skin %> td
{
white-space:nowrap;
}
</style>
</head>
<body class="BODY">
<form runat="server" id="mainForm" method="post" style="width: 100%;">
<div>
<telerik:MySection508Grid
ID="MyGrid1" Skin="Sunset" DataSourceID="SqlDataSource1"
AllowPaging="true" AllowSorting="true"
runat="server" OnColumnCreated="MyGrid1_ColumnCreated">
<MasterTableView Caption="Customers" Summary="Customers">
<PagerTemplate>
Change
page:
<asp:Button
ID="Button1" ToolTip="Previous Page" CommandName="Page"
CommandArgument="Prev"
CssClass="rgPagePrev"
runat="server" />
<asp:Button
ID="Button2" ToolTip="Next Page" CommandName="Page"
CommandArgument="Next"
CssClass="rgPageNext"
runat="server" />
</PagerTemplate>
</MasterTableView>
</telerik:MySection508Grid>
<asp:SqlDataSource
ID="SqlDataSource1" runat="server" ConnectionString="<$
ConnectionStrings>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address FROM Customers" />
</div>
</form>
</body>
|
| C# |
Copy Code |
|
protected void MyGrid1_ColumnCreated(object
sender, GridColumnCreatedEventArgs e)
{
e.Column.HeaderButtonType = GridHeaderButtonType.PushButton;
}
|
| VB.NET |
Copy Code |
|
Protected Sub MyGrid1_ColumnCreated(ByVal sender As Object, ByVal e As
Web.UI.GridColumnCreatedEventArgs) Handles MyGrid1.ColumnCreated
e.Column.HeaderButtonType = Web.UI.GridHeaderButtonType.PushButton
End Sub
|
| MySection508Grid C# class in App_Code |
Copy Code |
|
using Telerik.Web.UI; namespace Telerik.Web.UI
{
public class MySection508Grid : RadGrid
{
public MySection508Grid()
{
//
}
protected override void
RegisterScriptControl()
{
//
}
protected override void
RegisterScriptDescriptors()
{
//
}
protected override void
RegisterCssReferences()
{
//
}
}
}
|
| MySection508Grid VB.NET class in App_Code |
Copy Code |
|
Imports Telerik.Web.UI
Namespace Telerik.Web.UI
Public Class MySection508Grid
Inherits RadGrid
Public Sub New()
End Sub
Protected Overloads Overrides Sub RegisterScriptControl()
End Sub
Protected Overloads Overrides Sub RegisterScriptDescriptors()
End Sub
Protected Overloads Overrides Sub RegisterCssReferences()
End Sub
End Class
End Namespace
|