Work around for missing asp:img title attribute?

  • Thread starter Thread starter keith
  • Start date Start date
K

keith

In an MSDN article on high quality design principles combined with
standards driven code, Microsoft states: that the image title attribute
should display when users roll over the image and that Non-visual browsers
will read this text to people who are blind. In my attempts to implement
this I have found that the ASP.Img control does not have an attribute for
title. It is necessary to use the ASP:IMG control instead of the html img
tag in user controls where the path to the image needs to reference the root
of the application. Is there a work-around for this?

Thanks,

Keith
 
In code you can use the Attibutes.Add() method to add any custom attribute
to the asp:image control that you need, including title like so:

myImage.Attributes.Add("title","this is a test");
 
The alt and title attributes work just fine on server-side IMG tags.

<img runat="server" alt="foo" title="bar" />

works like

<asp:Image AlternateText="foo" ToolTip="bar" />
 
Back
Top