I have an imagebutton like so:
<asp:ImageButton onmouseover="this.src='lc.gif';"
onmouseout="this.src='nc.gif';" id="ImageButton1"
runat="server" ImageUrl="nc.gif"
AlternateText="AGR"></asp:ImageButton>
The ImageButton1_Click event is like so:
Private Sub ImageButton1_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
ImageButton1.ImageUrl = "dc.gif"
ImageButton1.AlternateText &= " selected"
End Sub
When the mouse is over I need to change the image to lc.gif. When the mouse
is NOT over it should default back to its original image (nc.gif). HOWEVER,
when it is clicked it should go to dc.png. and stay there - no more mouse
over, out, etc. How can this be done.
Thanks a lot.
Jay
Cor - 30 Sep 2003 08:29 GMT
Hi Jay,
I think on this way,
\\\\\\\\\\\\\
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.ImageButton1.Attributes("onmouseover") = "this.src='lc.gif';"
Me.ImageButton1.Attributes("onmouseout") = "this.src='nc.gif';"
End Sub
Private Sub ImageButton1_Click(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
Me.ImageButton1.Attributes("onmouseover") = "this.src='dc.gif';"
Me.ImageButton1.Attributes("onmouseout") = "this.src='dc.gif';"
End Sub
////////////
I hope this helps?
Cor
Alex Papadimoulis - 30 Sep 2003 14:31 GMT
Hi Jay,
You'll have to dynamically add the attributes.
ImageButton1.Attributes.Add("OnMouseOver","this.src='lc.gif';) and what not.
Remove those attributes on the Click event like so:
ImageButton1.Attributes("OnMouseOver") = ""
Alex Papadimoulis
> I have an imagebutton like so:
>
[quoted text clipped - 19 lines]
>
> Jay