How to set focus on control in C#

You can put the focus on the following types of ASP.NET controls: Button, LinkButton, and ImageButton controls, CheckBox control, DropDownList control, FileUpload control, HyperLink control, ListBox control, RadioButton control, TextBox control.

The following C# code example shows how to set the focus on the control with the ID TextBox1:

protected void Page_Load(object sender, EventArgs e)
{
    TextBox1.Focus();
}

Related TutorialsHow to transfer […]

How to set focus on control in VB.NET

You can put the focus on the following types of ASP.NET controls: Button, LinkButton, and ImageButton controls, CheckBox control, DropDownList control, FileUpload control, HyperLink control, ListBox control, RadioButton control, TextBox control.

The following VB.NET code example shows how to set the focus on the control with the ID TextBox1:

Protected Sub Page_Load(ByVal sender As Object, _    ByVal e […]

Recommended ASP.NET Examples