Although this tip creates onmouseover and onmouseout attributes in the IMG tag within the A tag when rendered to the browser, it could be used to set any attributes.
Create a Hyperlink control on the .aspx page (with an ID of ‘lnkImage’ in this example). In the codebehind, create a new image, set it’s attributes and add it to the controls collection of the hyperlink (substitute you own images for icon.gif and icon_hot.gif):
Private Sub Page_Load ... Dim IMG as new WebControls.Image IMG.ImageUrl = "Images/icon.gif" IMG.Attributes.Add("onmouseover", "this.src='Images/image_hot.gif';") IMG.Attributes.Add("onmouseout", "this.src='Images/image.gif';") IMG.Controls.Add(IMG)End Sub