Recent Articles

ASP.NET - Block IP Addresses From Your Site
Recently, one of my readers asked me how to block certain IP addresses from accessing his ASP.NET website. It was a good question that could be answered in multiple correct ways. My answer was a plug 'n play HttpModule that could be reused in any ASP.NET...

ASP.NET: Maintain Scroll Position After Postbacks
To maintain the scroll position after postbacks is important for larger web pages in order to let the user know exactly what is going on. It is good usability and something you would expect in modern web...

GZip Vs. Deflate - Compression And Performance
After I wrote about a HTTP compression module in ASP.NET 2.0 one of my colleagues pointed out that the Deflate compression is faster than GZip.Because the HTTP compression module chooses GZip over...

App_Code: Why It's Better
I remember when ASP.NET 2.0 beta 1 was released about 2 years ago and I eagerly tried it out. The first thing that struck me as strange was the new application folders like App_Code, App_Data, and App_Themes etc.

Refactoring Your ASP.NET Project
One day at work i was refactoring my code as I do everyday, when it suddenly hit me that our ASP.NET projects were also refactored in a sense. For those of you who don't know what refactoring is, here's...

ASP.NET: Permanent Redirection
The easiest way to make a redirection in ASP.NET is using Response.Redirect(url). What it actually does is, that it creates a response with the "302 (Object Moved)" status code and the target destination. It tells the browser that the requested page is temporarily moved...

Validating a URL with Regular Expressions
I had to build web form that took user input from standard ASP.NET input controls. In one of the text boxes the user must enter a valid URL, so I had to make some validation logic. But first of all, I had to find out what kind of URL's we would accept as being valid.

Visual Studio 2005 - Publishing Web Site
What's the purpose of site precompilation? As it turns out, improved performance is often brought as an evidence of the benefits of precompilation. While precompilation certainly saves users from the notorious first-hit delay, I don't believe that this simple...


01.26.07


ASP.NET: Make GridView Control Accessible

By Mads Kristensen

The GridView is a new web control in ASP.NET 2.0 and is an improvement of the old DataGrid.

One of the biggest issues with the DataGrid was the lack of standard compliance and accessibility. This has been fixed in the new GridView along with a lot of other things as well.

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.

For some strange reason, there is no property for setting the <thead>, <tbody> and <tfoot> elements which are more important from an accessibility point of view. There is however an easy way of adding these elements in C# and VB.NET.

Let's add a simple GridView to our page like this:



Low Rate eCommerce & Retail Plans

Then we just call the method from the Page_Load event like this:



It is not apparent that you have to dig into the header and footer rows and add a TableSection. This should be done automatically or at least be easy to set through a property at design time. I think it is an obvious mistake, but luckily for us, it is easy to fix if you know where to look.

Comments


About the Author:
Mads Kristensen currently works as a Senior Developer at Traceworks located in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in 2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and web services in his daily work as well. A true .NET developer with great passion for the simple solution.

http://www.madskristensen.dk/

About WebProASP
WebProASP is a collection of up to date tutorials and insightful articles designed to help ASP users of any skill level implement successful ASP systems and practices. ASP Strategies and Tactics for Business

WebProASP is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQlProNews.com
ITcertificationNews.com SysAdminNews.com
WebProASP.com WirelessProNews.com
CProgrammingTrends.com ITManagementNews.com




-- WebProAsp is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2007 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article



ASP Strategies and Tactics for Business WebProASP News Archives About Us Feedback WebProASP Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact