After much searching and experimentation, i finally found a way to get the focus onto the login control of my page (i've moved it from the template.master to the AccessDenied.aspx page). just add the following code into your page:
protected void Page_PreRender(object sender, EventArgs e)
{
//Find the Login control inside the LoginView
System.Web.UI.WebControls.Login curLogin = (System.Web.UI.WebControls.Login)LoginView1.FindCo ntrol("Login1");
//Then find the Username textbox control
if (curLogin != null)
{
TextBox txtUsername = (TextBox)curLogin.FindControl("UserName");
//Now set the focus on it
txtUsername.Focus();
}
else
{
this.Response.Redirect("default.aspx", false);
this.Response.End();
}
}
not sure if it'll work in the masterpage scenarion, but works great in the AccessDenied (or new Login.aspx) page.
jimi
http://www.jamestollan.com