You may try to do the following:
-Register two scripts (one to create a function to focus on your texbox when page is displayed, second to register id of the textbox)
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "on_load",
"<script>function window_onload() \n { \n if (typeof(idLoginTextBox) == \"undefined\" || idLoginTextBox == null) \n return; \n idLoginTextBox.focus();\n } \n window.onload = window_onload; </script>");
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Focus", String.Format("<script>var idLoginTextBox=document.getElementById(\"{0}\").focus();</script>", this.loginForm.ClientID));
As the result you should get the following in your code:
<script>
function window_onload()
{
if (typeof(idLoginTextBox) == "undefined" || idLoginTextBox == null)
return;
idLoginTextBox.focus();
}
window.onload = window_onload;
</script>
<script>
var idLoginTextBox=document.getElementById("ctl00_LoginTextBox").focus();
</script>