protected override void OnLoad(EventArgs e) { base.OnLoad(e); // Sets up which input control to focus and which button to use on enter key. WebControl control = LoginPanel.FindControl("LoginView$LoginControl$UserName") as WebControl; if (control != null) { Form.DefaultFocus = control.ClientID; } control = LoginPanel.FindControl("LoginView$LoginControl$LoginBtn") as WebControl; if (control != null) { Form.DefaultButton = control.UniqueID; } }