Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
I have a login page on which a have 2 text box as usual for username and password and one button for login.
i have attached this page with master page in which one button is used that is sign up button.
when i press enter from keyboard after filling the fields it should focus login button but it is going to the signup page again
where is the problem?
Posted 6-Nov-12 23:21pm
Edited 7-Nov-12 0:09am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

on page load of login page set focus on login button object
 
loginButtonObject.Focus();
  Permalink  
Comments
Neelam Chandra (8015059) at 7-Nov-12 5:13am
   
no no ... here there should be your button's object which is on your login page.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Without seeing your code it's a bit difficult. All I can suggest is that you use the following property to make the browser submit the form in the way you want:
 
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.usesubmitbehavior.aspx[^]
 
Your login button should have UseSubmitBehavior="true" and the signup button should have UseSubmitBehavior="false"
 
This should tell the browser to submit the form using the login button when you press enter.
  Permalink  
Comments
jim lahey at 7-Nov-12 4:30am
   
You should post your code then.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi,
 

In your page load, bind your login button id as default.
 
here is the below syntax,
 
   Page.Form.DefaultButton = btnLogin.UniqueID;
 
Here, in the place of btnLogin, give your login button id.
 
Hope this helps.
  Permalink  
Comments
manognya kota at 7-Nov-12 7:03am
   
Welcome.
Happy coding :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 350
1 Jochen Arndt 190
2 Richard MacCutchan 135
3 Sergey Alexandrovich Kryukov 130
4 DamithSL 105
0 OriginalGriff 6,045
1 DamithSL 4,611
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,310


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 7 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100