As I'm sure you already know, one of the accessibility standards Section 508 covers is specifying alternate text for all images. Not a big deal, right? Well, what about images that are purely used for formatting, such as spacers? Well, just give it an empty string: <img src="spacer.gif" alt="" />. Ok, still not a big deal. Unfortunately, the Image control in ASP.NET 1.x only outputs alternate text if it contains a value. For instance, <asp:Image id="spacer1" ImageUrl="spacer.gif" AlternateText="" runat="server" /> does not render the alternate text. Instead, this is the output: <img src="spacer.gif" />. The only way to add an empty alternate text string is to do it programmatically: spacer1.Attributes.Add("alt", "").
ASP.NET 2.0 hit the streets with a new lease on life. The goal was to be more standards compliant. Every control has been changed to support XHTML standards in three modes: legacy (HTML 4.0), transitional (XHTML 1.0 Transitional), and strict (XHTML 1.0 Strict). Apparently, using legacy conformance will not render your tags in an XHTML-compliant manner, which I think is kind of stupid, but oh well. Anyway, back to the matter at hand... The new Image control adds a GenerateEmptyAlternateText property. As the name implies, this will give you the empty alternate text, but only if you set it to true. What's up with that!? Ok, I realize that this is kind of a small issue; but if you're so stuck on standards compliance - which I'm happy about, by the way - why not just automatically output empty alternate text if no alternate text is specified? I don't really have a problem with the GenerateEmptyAlternateText property, just give it a default of true. Heck, even if you only do it for transitional and strict modes, it'd still be nice - not that this has anything to do with XHTML conformance.