Gets or sets the control on the form to display as the control with input focus when the HtmlForm control is loaded.
Assembly: System.Web (in System.Web.dll)
Use the property to access the control on the form to display as the control with input focus when the HtmlForm control is loaded. Controls that can be selected are displayed with a visual cue indicating that they have the focus. For example, a TextBox control with focus is displayed with the insertion point positioned inside of it.
The control with focus can also be set using the Focus or SetFocus methods. These methods have precedence over the property. If either of these methods are called to set the control with focus, the value of the property is ignored.
The following code example demonstrates how to set the property to display a specified control on a form as the control with input focus when the form loads. When Form1 renders, notice that the insertion point is positioned in TextBox1, indicating that TextBox1 is the control with focus.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.