473,720 Members | 2,800 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Handle Double-click on <Input type="image">

I have an image "button" which causes a postback.

I handle the "click" with

If Request.Form("b tnBU7WD6_Submit .X") 0 Then...

this works great. However, when a user double-clicks the image button the
Page_Load (postback) is processed twice. This is a problem.

Is there any easy way to detect that the image button has been double-cliked
and posted back twice?

--
-Will
Mar 13 '08 #1
3 2255
Try creating a boolean Session Item at thee end of the click handler method
, and check for its presence before handling any subsequent clicks. If the
session item is not null at the beginning of the click handler method body,
that means it was already clicked.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
"Will" wrote:
I have an image "button" which causes a postback.

I handle the "click" with

If Request.Form("b tnBU7WD6_Submit .X") 0 Then...

this works great. However, when a user double-clicks the image button the
Page_Load (postback) is processed twice. This is a problem.

Is there any easy way to detect that the image button has been double-cliked
and posted back twice?

--
-Will
Mar 13 '08 #2
Thanks Peter. That's the solution I planned on going with.

I was hoping there was a way to detect it in the Postback, but I don't see
anything.

Thanks
--
-Will
"Peter Bromberg [C# MVP]" wrote:
Try creating a boolean Session Item at thee end of the click handler method
, and check for its presence before handling any subsequent clicks. If the
session item is not null at the beginning of the click handler method body,
that means it was already clicked.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
"Will" wrote:
I have an image "button" which causes a postback.

I handle the "click" with

If Request.Form("b tnBU7WD6_Submit .X") 0 Then...

this works great. However, when a user double-clicks the image button the
Page_Load (postback) is processed twice. This is a problem.

Is there any easy way to detect that the image button has been double-cliked
and posted back twice?

--
-Will
Mar 13 '08 #3
Disable the button client side onclick?

"Will" <Wi**@discussio ns.microsoft.co mwrote in message
news:05******** *************** ***********@mic rosoft.com...
Thanks Peter. That's the solution I planned on going with.

I was hoping there was a way to detect it in the Postback, but I don't see
anything.

Thanks
--
-Will
"Peter Bromberg [C# MVP]" wrote:
>Try creating a boolean Session Item at thee end of the click handler
method
, and check for its presence before handling any subsequent clicks. If
the
session item is not null at the beginning of the click handler method
body,
that means it was already clicked.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
"Will" wrote:
I have an image "button" which causes a postback.

I handle the "click" with

If Request.Form("b tnBU7WD6_Submit .X") 0 Then...

this works great. However, when a user double-clicks the image button
the
Page_Load (postback) is processed twice. This is a problem.

Is there any easy way to detect that the image button has been
double-cliked
and posted back twice?

--
-Will

Mar 13 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5398
by: Bright Sun | last post by:
Hi, I have a ListView that is shown in Details mode, and the Checkboxes property is set to true. My problem is that I dont want the checkboxes being activated when items in the ListView are double-clicked. Is this possible? Thanks! Bright
4
1790
by: Tor Inge Rislaa | last post by:
DoubleClick in DataGrid Hi I have a Datagrid bound to a dataset that I want to write a DoubleClick procedure on. My problem is that the DoubleClick event is raised only when DoubleClicking the column or row header. How is it possible to get a DoubleClick event to occur on a row wherever it is DoubleClick. I also want, when a cell within the row is selected, that the entire row is marked as selected not just the actual cell. TIRislaa
2
3369
by: Boni | last post by:
Dear all, I am interested in mouse down and double click events of a control. When doubleclick happens the processing for mouse down should't be done I did follwing: sub MyMouseDown(.) handles MouseDown(..) if e.clicks>1 then return 'This is double click <-----------------(*) .... end sub sub DoubleClick(.) handles DoubleClick(..) end sub
3
6614
by: LCAdeveloper | last post by:
Help! A trawl through the archives couldn't shed any light on this, so is there a way to handle DoubleClick events for RadioButtons in vb.NET? I'm recoding a VB4 application, which used the double-click event on some SSOption buttons and would like to duplicate this behaviour (for existing users) in the vb.NET version. Using the cursor arrows to navigate through radiobuttons contained in a groupbox inititates the click event for the...
3
8270
by: C Glenn | last post by:
I would like one DoubleClick event handler to handle all double clicks throughout a DataGrid. I've assigned a DoubleClick event handler to the DataGrid and it works nifty-spiffy so long as I click outside the data. The trouble is, the underlying cells or columns or whatever would like to have something to say about this. The cells respond to the DoubleClick but not the grid. How do I get my event handler to handle all double clicks...
4
3267
by: _DD | last post by:
TrackBar DoubleClick event is not accessible via the Control Properties event pane. So I tried adding the handler directly: this.ColTrackBar.DoubleClick += new System.EventHandler(this.ColTrackBar_DoubleClick); It compiles but never fires. I suspect that individual Click events are getting gobbled up by the main trackbar position event handler. Any way around this?
3
5707
by: Zytan | last post by:
I can handle DoubleClick on a ListBox to respond, not when the selection changes, but when you double click one to invoke an action. This is the same as using the keys to move the selection, then pressing Enter. But, of course, DoubleClick doesn't automatically handle that. Is there any way to handle ALL standard UI at once, rather than checking for DoubleClick and for Enter press manually? Zytan
18
4604
by: Zytan | last post by:
I want the same function to be run whether you press Enter or double click the listbox. It seems really verbose to write both handlers to both events everytime, even if they both call the same function, or one calls the other. Isn't there an event for 'ListBox selection selected' that is automatically called by ALL the standard GUI ways of doing it? C'mon, this is C#, we aren't supposed to be programming the GUI. There has to be such...
3
12296
by: | last post by:
I have a control that need to perform one behavior when it's Clicked and a different behavior when it's DoubleClicked. It seems that you can't get a DoubleClick without first getting a Click. So what's the best way to keep from executing the click functionality before it's determined if it's a double click or not? Or do I just have to "undo" the Click stuff everytime a DoubleClick is received? Thanks. J
1
4445
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I've panel in my windows form, and i want to get the exact mouse position when i double click. I used: Point p = this.panel1.PointToClient(Cursor.Position); but now, if i'm pointing on the top-left corner of the panel i get the cordinates (0,0), and then, i'm scrolling with the mouse whell, and then i double click again, on the same corner and i get the same result.
0
8833
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8727
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
9365
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...
1
9126
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9055
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
7998
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...
0
4748
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3186
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
2567
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.