473,587 Members | 2,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<ENTER> causes ImageButton to fire! (weird)

I'm using VS 2005 to develop an intranet asp.net web application and I get a
weird situation. If I start out with any ASPX page that contains an
ImageButton control followed by a TextBox control, everything works okay. I
can press <ENTER> when the cursor is inside the text box and the page is
running, and no events fire (this is what I expect). But as soon as I drop a
second text box on the page (ie: after th first one) then pressing <ENTER>
in the first text box while running causes the ImageButton1_Cl ick to fire
(even though I'm not actually clicking on the ImageButton control!!!).

I've included a very simple test program below that illustrates the problem.

This is a big problem because I want to have many ImageButton and TextBox
controls on the same ASPX page, and I also do not want the ImageButton Click
event to fire when the user simply presses <ENTER> in a text box. If the
user presses <ENTER> in a text box, or types in data and then presses
<ENTER>, it does the application no good to start firing off Click events
from some unrelated control. In my case it makes my calendar expand out of
nowhere on the page (because the ImageButton control in my case is a "+"
tree expander that is intended to expand or hide the calendar).

What causes this behaviour and how can I fix it?

Thanks,

Tom Edelbrok

Here is the ASPX page (and at the bottom of the post is the Code-Behind VB
stuff):

<%@ Page Language="VB" AutoEventWireup ="false" CodeFile="Main. aspx.vb"
Inherits="main" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Untitl ed Page</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:ImageButto n ID="ImageButton 1" runat="server" />

<asp:TextBox ID="TextBox1" runat="server"> </asp:TextBox>

<asp:Button ID="Button1" runat="server" Text="Button" />

<asp:TextBox ID="TextBox2" runat="server"> </asp:TextBox><br />

<br />

<br />

<br />

<br />

</div>

</form>

</body>

</html>

HERE IS THE CODE-BEHIND VB STUFF:

Partial Class Main

Inherits System.Web.UI.P age

Protected Sub ImageButton1_Cl ick(ByVal sender As Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles ImageButton1.Cl ick

Response.Write( "ImageButton1_C lick firing")

End Sub

End Class
May 18 '06 #1
0 1818

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

Similar topics

11
24331
by: Denis Hierstein | last post by:
I need a function, witch make a break in a for-loop and wait for the <enter>-key ... when I use Pascal I just use the Read; or the ReadLn;-function, then the loop stop as long as the user push the <Enter>-key.
7
20364
by: jerrygarciuh | last post by:
Hello, I have been playing with various Googled solutions for capturing the <Enter> key to suppress form submission. My first question is whether anyone has a script that works in all common browsers? The script bellow is IE only. It fails FF 1.0 and NN 7. Also, if I can trap the keypress I would like to use it to tab to the next tabindex.
7
6687
by: Susan Bricker | last post by:
I know that I saw some information concerning the <shift>+<enter> combination use to bypass launching an Access mdb application and enter the Access design workspace. Would someone please direct me to some information on how to disable this function (and how to re-enable it)? I believe that I saw some article that showed how to incorporate this into a command button. That would work for me as I have three different sign-on authorities...
6
2425
by: tor | last post by:
Hello How can I use an other key then TAB to move from one textBox to another?? Torfinn
0
1288
by: VMI | last post by:
If I'm in a multi-line textbox and I'm writing a postal address (ie. write ist line and press <Enter>, write 2nd line and press <Enter>, etc...) how can I make sure that the Enter key will always make the cursor jump to the following line in the textbox? For some reason, and this happens everywhere except on my development PC (and it's not consistent), if a user's writing a line and presses the <Enter> key, the program interprets that as...
2
9470
by: JP | last post by:
Hi, It's a login screen, so users enter their ID/Password and hit <ENTER> instead of clicking on Login button. But when they hit <ENTER> an Image Button gets clicked. I want to make my Login Button a default so that when users hit <ENTER> key, Login Button receives a click. Please help!
2
1818
by: Rocio | last post by:
I have a aspx page, with 2 controls (ascx). Control1 contains a SEARCH button, and textbox to enter the string to search for. Control 2 contains a LOGIN button, and 2 text boxes to enter the username & password to login. Any user can perform a search, but if he applies for an account, he can login and performed an enhanced search. Currently, the SEARCH button responds when the user clicks <Enter>,
4
2173
by: Paul W | last post by:
On my simple login-screen I have a 'username' and 'password' field and an imagebutton for the 'OK'. This used to work nicely so that when the user hit <Enter> from the password field, it invoked the VB code behind the image-button, and away he went. Suddenly this has stopped working like this. It still works if you use the mouse to click on the button, or first TAB to it, then click <Enter>. However, if you now hit <Enter> with the...
4
2877
by: peshrad | last post by:
Hi ! I'm working with Win 2K and Visual Studio 2003. I have a problem because pressing <ENTER> in a text input control causes a postback of my web form. Here comes some example code (already stripped of most of the unnecessary code): ----------------------------------------------------------------------------
2
2157
by: Stevecbl | last post by:
Hello, I have an application that works on a PPC 2003 device but causes a slight problem on a WM 5.0 device. These devices are equipt with barcode scanners. The problem that I am seeing is that on the WM 5.0 device, when I scan a barcode in a combo box, the list is automatically displayed hiding the text box below it. I have to click somewhere on the screen to close it. This does not happen on the PPC 2003 device. I have looked into the...
0
8349
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
8221
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
6629
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
5722
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
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3845
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...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.