Set focus to textbox in ASP.NET Login control on page load -
I am trying to set the focus of the user name text box inside an ASP.NET login control.
I have tried it in some way but no one is working. The page is loading, but not going under control.
Whatever code I have here I have.
SetFocus (this.loginForm.FindControl ("UserName"));
and
text box tbox = (TextBox) this.loginForm.FindControl ("UserName"); If (tbox! = Null) {tbox.Focus (); } // if
Are you using a ScriptManager on the page? If so, try the following:
Public Zero SetInputFocus () {Text box tbox = this.loginForm.FindControl ("username") as text box; If (tbox! = Null) {ScriptManager.GetCurrent (this.Page) .SetFocus (tbox); }}
Update: Never used multiview before, but try:
Protected Zero MultiView1_ActiveViewChanged (Object Sender, EventArgs e) { SetInputFocus (); }
Comments
Post a Comment