- 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:
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.
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.