473,670 Members | 2,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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********@hotm ail.com
www.nathansokalski.com
Nov 19 '05 #1
1 5795
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.p hx.gbl, "Nathan
Sokalski" <nj********@hot mail.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1690
by: Jeremy Robertson | last post by:
I'm working on an application that manages large image files (mulit-page ..Tiff's to be exact some 1000+ pages). I've written an user control that displays a number of the images as thumbnails in a scrollable window. The user can select and modify Images from my thumbnail control. I need to let the user re-arrange the images if they are out of order. I need the user to be able to click on a thumbnail or multiple and DRAG them to the...
5
4560
by: Tim Bücker | last post by:
Hello. I have a window form with some panels on it. In one panel I am using the OnMouseDown and OnMouseUp events. MouseDown initiates some things and MouseUp releases some things - so it is important that I get both events! Problem: The user presses the mouse but than leaves the panel and releases the mouse outside this panel.
4
4348
by: Colin McGuire | last post by:
Hi again, thanks everyone for your previous help. But having resolved past problems, I'm moving on to new problems :( This one is a simple winforms application with two buttons, named Button1 and Button2, on it (code below). When I press the mouse button over Button2, and don't release it, in the IDE output window it prints "Button2_MouseDown" only. If I release the mouse button over the button, over the form, or even over ANY other...
1
2785
by: Alan | last post by:
i have a form with a label on it Private Sub Label1_mousedown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown ' do stuff End Sub Private Sub Label1_mouseup(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseUp
2
4707
by: dave.wayne | last post by:
In a web page I have a div tag that has a onlick event registered through the event listener. However, that same div tag also has a onmousedown - start a drag and drop script The problem I am having is that once the drag and drop is complete, the mouse button is released and the onclick event is firing. I've tried returning false from the function dealing with the mouse up and cancelling the event with if (e.stopPropagation)...
3
3582
by: Techsatish | last post by:
how to make a mouseup event called only once during a double click event? here double click is made on a tree node in a tree control. I have the code inside mouseup event....in runtime the mouseup is called twice for the mouse double click over the selected tree node. I want mouseup event to be called onece Any ideas?
1
5212
by: JDeats | last post by:
It appears the WinForm MouseDown and MouseUp event handlers are not working properly. In the "bare bones" sample application below, Form1_MouseUp gets called even through the mouse button remains pressed while dragging the Form window to resize it. Can this "problem" be explained as some sort of by-design behavior? If so what is the work around to detecting when a user has completed resizing a Windows Form by way of mouse drag? / ...
12
4010
by: Tom Bean | last post by:
I am trying to display a ContextMenuStrip when a user right-clicks on an item in a ListView and have encountered a something that seems strange to me. When the ListView is initially populated, no items are selected. When the first item is selected by clicking either the left or right button, the SelectedIndexChanged event fires but not the MouseUp event. After the first item is selected and another item clicked on, both the...
2
3124
by: markszlazak | last post by:
In the following script, a control displays (black box) in each table cell once you mouse over the cell. Mouse down on the control to change the mode of the table. Drag the mouse over cells in the same column then mouseup anywhere in a cell. The mouseup event sometimres fires before the selection of table cells by dragging is complete. It's important that I stop these "false" mouseup's from firing or distinguish them from when I let go of...
0
8386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8903
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8814
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8661
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7419
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6213
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2800
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2042
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.