<%@ Page language="C#" %>
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
this.SetFocus("Pswd");
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Focus to the control</title>
</head>
<body>
<div id="pageContent">
<form id="Form1" runat="server">
<h1>Please, login</h1>
<h3>User</h3>
<asp:textbox runat="server" id="UserName" text="" /><br />
<h3>Password</h3>
<asp:textbox runat="server" id="Pswd" text="" TextMode="Password" /><br />
<asp:button runat="server" id="Login" text="Log in" />
<hr />
</form>
</div>
</body>
</html>