Thursday, October 2, 2008

Set focus On The Username Text Box For Login

In c# you can use this simple insctruction:

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
SetFocus(Login1.FindControl("UserName"));
}
</script runat="server">

Inside the code behind you can in general use:

SetFocus(TextControlID);