Click here to Skip to main content
15,900,378 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I have created a login page with login button as default button, so that when I press enter key login button will be raised.

My problem is for the first time i entered my login id, pwd then loggedin then browser(Chrome) asked to save password, i have saved password. then the next time onwards when i opened login page it was loading loginid, password automatically when i press enter key it was asking me to enter password although the password is already loaded.
but when i press enter key again its working.

this was not happening with IE, error is with Google Chrome only.

please tell me the solution if any of you encountered this problem.

Thanks in advance.
Posted
Updated 30-Oct-14 2:43am
v3
Comments
Member 10528646 30-Oct-14 9:33am    
try by not saving form fill history in the browser
ClimerChinna 31-Oct-14 0:16am    
End user may not do the same right? As a Developer we need to think of end user point of view.

Make sure that you have set the focus to the "loginid" textbox at the time of page load. The deafult button responds to the form and thus it may need the focus to be on any of the control inside that form which seems to be browser specifi behavior, although I am not sure about this.

To set focus on a textbox, in page load event you may simply write-

C#
textbox1.Text.focus();


If this doesn't work, try this-

C#
ScriptManager.RegisterStartupScript(this, this.GetType(), "Focus", "$get('" + textbox1.ClientID + "').focus();", true);


or
C#
ClientScript.RegisterStartupScript(this, this.GetType(), "Focus", "$get('" + textbox1.ClientID + "').focus();", true);


I hope this works. In case it doesn't work, please let me know.
 
Share this answer
 
Comments
ClimerChinna 31-Oct-14 0:15am    
thanks for the answer,
but it was not working same error repeated.
textbox1.text.focus is not working I have tried textbox1.focus()
Suvendu Shekhar Giri 31-Oct-14 1:22am    
Need more information as it is working fine at my end when I am testing with Chrome (Version 38.0.2125.104) and it's working perfectly fine.
Can you please provide these information:
1. Version of Chrome ?
2. Is your page a content page of a master page ?
3. Logic you have written in Page_Load event or, you may post the code directly or slightly modifying it, if no issues in sharing

Just another question, have you tried this -

ScriptManager.RegisterStartupScript(this, this.GetType(), "Focus", "$get('" + textbox1.ClientID + "').focus();", true);
ClimerChinna 31-Oct-14 1:38am    
could you please post your code so that i can compare it with my code,
my chrome version is-38.0.2125.111 m
my page is content page no master page is there for it
I have some problems in sharing the code

Yes, I have tried scriptmanager also but its not working
i have added onkeydown event to the form,

when i have removed it its working fine now.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900