Skip to main content
Tab

ASPxWebControl.Focus() Method

Sets input focus to the web control.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.2.dll

NuGet Package: DevExpress.Web

Declaration

public override void Focus()

Remarks

On mobile devices, the Focus method does not invoke the keyboard, because it can be displayed in response to user actions only. For instance, you can focus a text box in a user-generated event handler, such as a button click.

The code sample below demonstrates how to focus a text box and display the keyboard in code.

<dx:ASPxTextBox runat="server" ID="ASPxTextBox1" ClientInstanceName="textBox" />
<dx:ASPxButton ID="ASPxButton1" runat="server" Text="ASPxButton" AutoPostBack="false">
    <ClientSideEvents Click="function(s, e) { textBox.SetFocus(); }"
</dx:ASPxButton>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Focus() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also