Click here to Skip to main content
Sign Up to vote bad
good
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 - 22:21
Edited 6 Nov '12 - 23:09


3 solutions

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
PreetSidhu15 - 7 Nov '12 - 5:34
that really works...thanku so much
manognya kota - 7 Nov '12 - 7:03
Welcome. Happy coding :)
on page load of login page set focus on login button object
 
loginButtonObject.Focus();
  Permalink  
Comments
PreetSidhu15 - 7 Nov '12 - 5:08
loginbuttonobject is any property or something else?
Neelam Chandra (8015059) - 7 Nov '12 - 5:13
no no ... here there should be your button's object which is on your login page.
PreetSidhu15 - 7 Nov '12 - 5:33
that didn't work but i got solution from other suggestion. anyway thanks
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
PreetSidhu15 - 7 Nov '12 - 4:26
i have already done that.
jim lahey - 7 Nov '12 - 4:30
You should post your code then.

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 178
1 Tadit Dash 144
2 Santhosh G_ 140
3 Sergey Alexandrovich Kryukov 134
4 Espen Harlinn 120
0 Sergey Alexandrovich Kryukov 10,348
1 OriginalGriff 7,965
2 CPallini 4,241
3 Rohan Leuva 3,522
4 Maciej Los 3,184


Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 7 Nov 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid