Home > .net 3.5, Microsoft, Visual Studio 2008 > .NET 3.5 DataPager Controls and XHTML Compilance

.NET 3.5 DataPager Controls and XHTML Compilance

February 11, 2008

As I put the finishing touches on the new Web Gallery, my final checks for full XHTML 1.1 Transitional compilance are at full steam.  One of my goals for the project is to comply (which is against my nature ;)) and still have an operational web site.  Part of that included using the new ListView controls, DataPager, and CSS Friendly adapters.

The one that caught me, however, was the DataPager.

“There is no attribute “disabled”.”

The validator was caught up by a line of code generated by the DataPager control’s NextPreviousPagerField.

By default, the NextPreviousPagerField generates hyperlinks and decorates them with disabled=”disabled” when they are invalid.  Unfortunately, that’s not XHTML compliant since the “disabled” property doesn’t exist for an “a” tag.

To fix this, add the RenderDisabledButtonsAsLabels=”true” property to your NextPreviousPagerField controls.  Instead of “disabled” hyperlinks, this simply generates labels.

Now, we’re compliant:

Compliances for the new Web Gallery.

  1. March 14, 2009 at 2:53 pm

    this doesnt work for me… just tried 100 different combinations to make sure something else wasnt causing it, but I consistently get the rendered output. Frustrating.

    this also after I had to hack the datapager to not put “Page=1” on the first page link… since this will cause duplicate content issues on the site. amazing.

  2. Wayne
    July 16, 2009 at 7:02 am

    Adding RenderDisabledButtonsAsLabels=”true” to NextPreviousPagerField only works if you don’t have QueryStringField=”xxx” in the DataPager

  1. No trackbacks yet.
Comments are closed.
%d bloggers like this: