Solved

Asp.net login control - Log in on Enter key press?

Posted on 2007-11-27
3
3,882 Views
Last Modified: 2013-11-07
Hi,

I thought that the default behaviour for the login control was to log in on the Enter Key press instead of clicking the Log In button but this isn't working for me.  The Login Control's LoggingIn event doesn't fire when the Enter key is pressed so the page just refreshes without logging in.  When I log in by clicking the button everything works fine.

Anyone know why this is happening?
0
Comment
Question by:fizzer666
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
TornadoV earned 500 total points
Comment Utility
Here is what I had to do in order to make it work:

ImageButton buttonLogin = Login1.FindControl("LoginImageButton") as ImageButton;
Page.Master.Page.Form.DefaultButton = buttonLogin.UniqueID;

As you can see I'm using an imagebutton and master page, in any case,  you get the idea.

Hope this helps.
0
 
LVL 11

Expert Comment

by:TornadoV
Comment Utility
Btw, that code goes inside of Page_Load.
0
 

Expert Comment

by:Sharalynn
Comment Utility
btnLogin.UseSubmitBehaviour = True
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now