954,198 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Enter doesn't execute button.click

For some reason, when I am in the password text box, when I press enter, it simply clears both fields. Doesn't validate, doesn't login, just clears the fields. What is going on here?

Codebehind:

PrivateSub cmdLogin_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.ServerClick
If FormsAuthentication.Authenticate(txtUser.Text, txtPass.Text) Then
FormsAuthentication.RedirectFromLoginPage(txtUser.Text, chkPersist.Checked)
Else
lblStatus.Text = "Not Authenticated"
IfCInt(ViewState("Tries")) > 1 Then
Response.Redirect("Denied.aspx")
Else
' Otherwise, increment number of tries.
ViewState("Tries") = CInt(ViewState("Tries")) + 1
EndIf
EndIf
EndSub




And the aspx page is attached. Please help.

Slade

Attachments FacLogin.txt (3.37KB)
Slade
Practically a Master Poster
633 posts since Mar 2004
Reputation Points: 115
Solved Threads: 7
 

Is the viewstate enabled? Is the page properly posting back? Try putting in a Response.Write somewhere...

Tekmaven
Software Architect
Moderator
1,274 posts since Feb 2002
Reputation Points: 322
Solved Threads: 28
 

clicking on the button actually works but..?

Slade
Practically a Master Poster
633 posts since Mar 2004
Reputation Points: 115
Solved Threads: 7
 

ok clicking on the actual button with the mouse WORKS, but when I hit enter and I'm in the password field, it just clears the form whats the deal? It should just login like when I click it, please help.


Thanks in advance,

Slade

Slade
Practically a Master Poster
633 posts since Mar 2004
Reputation Points: 115
Solved Threads: 7
 

Ah, well, when you hit enter, the button isn't a default button :-P. You'll either need to write some javascript here, or use the free MetaBuilder's DefaultButtons Control .

Tekmaven
Software Architect
Moderator
1,274 posts since Feb 2002
Reputation Points: 322
Solved Threads: 28
 

As always tekmaven you were helpful, that control is awesome. Where do you find out about all of them?

Slade
Practically a Master Poster
633 posts since Mar 2004
Reputation Points: 115
Solved Threads: 7
 
As always tekmaven you were helpful, that control is awesome. Where do you find out about all of them?


Just about every employee that works on .NET at Microsoft has blogs. Just get a good RSS agregator, and check them all. With a little time each day (okay, maybe a lot), I guaruntee you will learn a lot.

And, the thanks for the kind words. Don't forget to share that thought with the member rating system ("reputation").. ;) .

Tekmaven
Software Architect
Moderator
1,274 posts since Feb 2002
Reputation Points: 322
Solved Threads: 28
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You