How will you set focus to the control?

 Posted by Bhakti on 12/4/2009 | Category: ASP.NET Interview questions | Views: 2560
Answer:

You can do it either using JS, for attribute or control method.
With JS, you will have to use focus method.
function focustest()

{
document.getElementById("TextBox5").focus();
}

With form, you can add attribute called “defaultfocus” to the desired control.
defaultfocus="TextBox5
" sets focus to textbox5.
And programatically, you can set it by :
TextBox5.Focus()


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response