Wednesday, 9 August 2006

Roll Over images

Jeff
I wanted to have my image buttons change on roll over on a website and really thought the ASP.NET ImageButton would of had a RollOverImageUrl property on it that automatically changed the image onmouseover and onmouseout. However I soon found out the is no such functionality :-(

So I extended the ImageButton and the ButtonField controls to have this property and handle the rollover. It simple to do just set the onmouseover and onmouseout attributes of the ImageButton to toggle the src to the correct url of the image. You can find the source here.

No comments: