Need help with ImageButton
-
I am using asp:ImageButton control . I want to associate 3 images with it, for MouseOve, MouseOut and MouseClick events. How can i achieve this ? Right now, i m using
Apurv A man is but the product of his thoughts. What he thinks, he becomes. .......Mahatma Gandhi Be the change you want to see in the world. .......Mahatma Gandhi
-
I am using asp:ImageButton control . I want to associate 3 images with it, for MouseOve, MouseOut and MouseClick events. How can i achieve this ? Right now, i m using
Apurv A man is but the product of his thoughts. What he thinks, he becomes. .......Mahatma Gandhi Be the change you want to see in the world. .......Mahatma Gandhi
You will need to write javascript to do this, I don't believe the control supports it directly.
Christian Graus Driven to the arms of OSX by Vista.
-
I am using asp:ImageButton control . I want to associate 3 images with it, for MouseOve, MouseOut and MouseClick events. How can i achieve this ? Right now, i m using
Apurv A man is but the product of his thoughts. What he thinks, he becomes. .......Mahatma Gandhi Be the change you want to see in the world. .......Mahatma Gandhi
In Page_Load Add
btnAYes.Attributes.Add("onmouseover", "src = 'images/pic1.png'")
btnAYes.Attributes.Add("onmouseout", "src = 'images/pic2.png'")
btnAYes.Attributes.Add("onmouseclick", "src = 'images/pic3.png'") -
In Page_Load Add
btnAYes.Attributes.Add("onmouseover", "src = 'images/pic1.png'")
btnAYes.Attributes.Add("onmouseout", "src = 'images/pic2.png'")
btnAYes.Attributes.Add("onmouseclick", "src = 'images/pic3.png'")why not just put it in the aspx ?
Christian Graus Driven to the arms of OSX by Vista.
-
why not just put it in the aspx ?
Christian Graus Driven to the arms of OSX by Vista.
Like this you mean:
<img name="img1" src="/images/whatever1.gif" onmouseover="document.images['img1'].src = '/images/whatever2.gif';" onmouseout="document.images['img1'].src = '/images/whatever1.gif';">
I never thought about that until you asked why not. :doh: The other method has always done what I needed.
-
Like this you mean:
<img name="img1" src="/images/whatever1.gif" onmouseover="document.images['img1'].src = '/images/whatever2.gif';" onmouseout="document.images['img1'].src = '/images/whatever1.gif';">
I never thought about that until you asked why not. :doh: The other method has always done what I needed.
Yeah, both ways work, I guess the real question is, when you're maintaining the code, which is the place you're most likely to expect to see this set ? I'd expect that depends on the coder, you're used to looking in one place, I am used to looking in the other.
Christian Graus Driven to the arms of OSX by Vista.
-
Yeah, both ways work, I guess the real question is, when you're maintaining the code, which is the place you're most likely to expect to see this set ? I'd expect that depends on the coder, you're used to looking in one place, I am used to looking in the other.
Christian Graus Driven to the arms of OSX by Vista.
For maintaining the code, it's definitely better in the aspx. But I just remember why I used the other method, i didn't get it to work in the aspx. And neither did I now. But I'll have a look into that tomorrow. It's way to late for my brain now.
-
Yeah, both ways work, I guess the real question is, when you're maintaining the code, which is the place you're most likely to expect to see this set ? I'd expect that depends on the coder, you're used to looking in one place, I am used to looking in the other.
Christian Graus Driven to the arms of OSX by Vista.
Well, I don't get it to work in the aspx. Asp:ImageButton doesn't support OnMouseOver or OnMouseOut natively. But if you know how to do it in the aspx I'm definitely interested.
-
In Page_Load Add
btnAYes.Attributes.Add("onmouseover", "src = 'images/pic1.png'")
btnAYes.Attributes.Add("onmouseout", "src = 'images/pic2.png'")
btnAYes.Attributes.Add("onmouseclick", "src = 'images/pic3.png'") -
Thanks ..... it working ... thank you very much ... :)
Apurv A man is but the product of his thoughts. What he thinks, he becomes. .......Mahatma Gandhi Be the change you want to see in the world. .......Mahatma Gandhi
You're welcome
-
You're welcome