all groups > asp.net building controls > february 2006 >
You're in the

asp.net building controls

group:

Image Rollovers with the Hyperlink Control


Image Rollovers with the Hyperlink Control Nathan Sokalski
2/17/2006 8:28:53 PM
asp.net building controls:
I have several System.Web.UI.WebControls.HyperLink Controls which I want to
display as rollover images. I know how to make these manually using the <a>
and <img> tags or the <a> tag and a System.Web.UI.WebControls.Image Control
or a HyperLink and Image Controls, but the onMouseOver and onMouseOut
attributes must be in the <img> tag. If I were to use the HyperLink's
ImageUrl property and add the attributes using the
HyperLink.Attributes.Add() method, I am assuming the attributes will appear
in the generated <a> tag. Is there a way to create a Hyperlink Rollover
without creating two Controls? Thanks.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

Re: Image Rollovers with the Hyperlink Control Kris
2/18/2006 12:02:14 AM
Hi Nathan,

Yes. You need not create two controls.

In HyperLink you have a property called ImageUrl. Use this property to
assign the image location.

Cheers,
Kris
AddThis Social Bookmark Button