Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello to all ,
my name is amit kumar , i am developing a website using asp.net , i have a registration page there are some text boxes to fill , i want to use auto focus event ,in all text-boxes ,
please let me know if is there any solution
Posted
Comments
Thanks7872 23-Sep-14 5:16am    
There is no problem, so there won't be any solution. If you have any issues/questions, you can ask.

C#
public void SetInputFocus()
{
    TextBox tbox = this.loginForm.FindControl("UserName") as TextBox;
    if (tbox != null)
    {
       ScriptManager.GetCurrent(this.Page).SetFocus(tbox);
    }
}
 
Share this answer
 
Comments
amitkumar5734 23-Sep-14 7:20am    
sir , can i use autofocus in radiobutton list .
vr reddy 23-Sep-14 7:41am    
ya sure
Autofocus means that a visual element (text box) will be in focus upon the page load, so user will not have to do nothing to start and fill the form. By the nature of focus (and with a little help of your common sense) you never can set focus on more than one element at the same time, so there is no way to set autofocus for "all text-boxes"...but for one only...
 
Share this answer
 
Comments
amitkumar5734 23-Sep-14 5:48am    
i want autofocus on click of enter button after filling data on one textbox . i don't want autofocus to all text boxes i want one by one click of enter button ,
Kornfeld Eliyahu Peter 23-Sep-14 5:51am    
For that you have to write some JavaScript code - search for 'javascript move focus on enter'

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900