Setting Focus in ASP.Net
I ran across this article in my search for setting focus to an individual field on page_load
The article was written by Roger McCook. Its real simple and it wouldn't have been hard to figure out, but since Roger figured it out for us, why waste any brain cycles.
protected void setFocus( System.Web.UI.Control ctrl )
{
string s = "<SCRIPT language='javascript'>document.getElementById('" + ctrl.ID + "').focus() </SCRIPT>";
this.RegisterStartupScript( "focus", s );
}
to use it you just do this.
this.setFocus( txUserId );
-Mathew Nolton