Making LoginButton the default button

Joined
Sep 30, 2006
Messages
4
Reaction score
0
I've got a login control Login1, within which there is the login button, LoginButton. I'm trying to make LoginButton the default button, so that when someone types the username and password and hits Enter, LoginButton is clicked. I've done the following:

Code:
protected void Page_Load(object sender, EventArgs e)
    {
        Button myLoginButton = (Button)Login1.FindControl("LoginButton");
        Page.RegisterHiddenField("__EVENTTARGET", myLoginButton.ClientID);
    }

But this doesn't work. Another button that appears higher up on the webpage is always the default button. Is there something I'm doing wrong here?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top