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

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -