473,394 Members | 4,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

how to fire a image button when user press enter key

i am making u user login page where there are few buttons at the top of the page like Home, Services, About Us etc

and below it i hav
Username -- textbox
Password --textbox
Login --image button...


now after a user hav filled the password box and when he press the enter key then the 'Login' should fire..... but this button is not firing in my case....
the first button is fired i.e Home button is fired...

can u plz xplain....

note:-

i have added a OnclientClick= return validateuser() in the <asp:imgbutton> tag and in the <script> tag i have written the following code for checking if the username and password box are not left blank...like this.....

Expand|Select|Wrap|Line Numbers
  1.  
  2. if(document.getElementById('<%= txtUsername.ClientID%>').value == "")
  3. {
  4. alert('Please enter username');
  5. document.getElementById('<%= txtUsername.ClientID%>').focus();
  6. return false;
  7. }
  8.  
Jul 14 '08 #1
2 2073
DrBunchman
979 Expert 512MB
Moved to .NET Forum.
Jul 14 '08 #2
DrBunchman
979 Expert 512MB
So is the problem that when the user presses the enter key the wrong button is being 'clicked' ? If so then put your Username, Password and Login button controls in a panel and set the DefaultButton property of the panel to the ID of the image button.

Hope this helps,

Dr B
Jul 15 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Tom Edelbrok | last post by:
To all: I am new to Visual Studio 2005 (VB.NET) and am writing my first web application. I see that controls, when double-clicked at design time, show you code for events that fire. In fact this...
4
by: sowencheung | last post by:
Hi, all The scenario is like this: I have a master page, contains two user controls, one is a search control, another is a login control. The server-side <form> is in the master page,...
0
by: Tom Edelbrok | last post by:
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,...
1
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...
0
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...

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.