473,385 Members | 1,555 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,385 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 2072
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.