468,242 Members | 1,679 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,242 developers. It's quick & easy.

MouseUp/MouseDown events for ASP.NET ImageButton

I want to create a pushbutton-like control on my webform that has an image
on it. I used to think that this is what the ImageButton control was, but it
seems to me that the ImageButton is nothing more than an image that can be
clicked. I have figured out a way to make the ImageButton look like a button
(there was some border property and the backgroud color). However, that
still does not make it look like it is being "pushed" the way other buttons
are. Because all I need to do to change the look between button up/button
down is change the border property, I hoped I could use the
MouseUp/MouseDown events to change this property. But for some reason the
ImageButton control does not have these events. This brings up 2 questions:

1. Why is the control called ImageButton when it does not have the same
properties or look as other types of buttons? I think a more appropriate
name would be something like HyperImage or Image Link, anything that does
not imply it acts and looks like a button.

2. What would be a good way to create the "pushing" effect of a button that
I am trying to get?

Thanks.
--
Nathan Sokalski
nj********@hotmail.com
www.nathansokalski.com
Nov 19 '05 #1
1 5430
You have to use client script and control appearance of the element on the
client. You can't use server code since up/down events do not come to the
server for performance reasons. Alternatively, you can try standard
asp:button and apply image to it using CSS background-image property via
either style or cssclass attribute.

Mikhail Arkhipov (Microsoft)
-- This post is provided 'AS IS' with no warranties and confers no rights

On 2/8/05 21:19, in article uS*************@TK2MSFTNGP15.phx.gbl, "Nathan
Sokalski" <nj********@hotmail.com> wrote:
I want to create a pushbutton-like control on my webform that has an image
on it. I used to think that this is what the ImageButton control was, but it
seems to me that the ImageButton is nothing more than an image that can be
clicked. I have figured out a way to make the ImageButton look like a button
(there was some border property and the backgroud color). However, that
still does not make it look like it is being "pushed" the way other buttons
are. Because all I need to do to change the look between button up/button
down is change the border property, I hoped I could use the
MouseUp/MouseDown events to change this property. But for some reason the
ImageButton control does not have these events. This brings up 2 questions:

1. Why is the control called ImageButton when it does not have the same
properties or look as other types of buttons? I think a more appropriate
name would be something like HyperImage or Image Link, anything that does
not imply it acts and looks like a button.

2. What would be a good way to create the "pushing" effect of a button that
I am trying to get?

Thanks.

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jeremy Robertson | last post: by
5 posts views Thread by Tim Bücker | last post: by
1 post views Thread by Alan | last post: by
12 posts views Thread by Tom Bean | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.