New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Setting Focus

FindAPlace

RadAjaxPanel/RadAjaxManager has a FocusControl method that lets you set focus to desired controls.
This example illustrates how you can use the RadAjaxManager1.FocusControl(Control.ClientID) method of the RadAjaxManager instance to set focus to a control after the Ajax request is complete.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • styles.css
<%@ Page Language="c#" CodeFile="DefaultCS.aspx.cs" AutoEventWireup="true" Inherits="Telerik.AjaxManager.Functionality.SettingFocus.DefaultCS" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" type="text/css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container size-thin no-bg">
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="ddlContinents">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="ddlCountries" LoadingPanelID="LoadingPanel1"></telerik:AjaxUpdatedControl>
                        <telerik:AjaxUpdatedControl ControlID="ddlCities" LoadingPanelID="LoadingPanel1"></telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="ddlCountries">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="ddlCities" LoadingPanelID="LoadingPanel1"></telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <div class="panelTop">
        </div>
        <div class="panelContent">
            <img src="images/FindAPlace.gif" alt="FindAPlace" />
            <div class="comboPanel">
                <asp:Label ID="Label3" runat="server" AssociatedControlID="ddlContinents">Continent:</asp:Label>
                <br />
                <telerik:RadComboBox RenderMode="Lightweight" ID="ddlContinents" AllowCustomText="false" runat="server" EnableLoadOnDemand="true"
                    AutoPostBack="true" Width="186px" OnItemsRequested="RadComboBox1_ItemsRequested"
                    OnSelectedIndexChanged="ddlContinents_SelectedIndexChanged" Skin="Office2010Silver">
                </telerik:RadComboBox>
            </div>
            <div class="panelSeparator">
            </div>
            <div class="comboPanel">
                <asp:Label ID="Label1" runat="server" AssociatedControlID="ddlCountries">Country:</asp:Label>
                <telerik:RadComboBox RenderMode="Lightweight" ID="ddlCountries" AllowCustomText="false" AutoPostBack="true"
                    runat="server" EnableLoadOnDemand="true" Width="186px" OnItemsRequested="RadComboBox2_ItemsRequested"
                    OnSelectedIndexChanged="ddlCountries_SelectedIndexChanged" Skin="Office2010Silver">
                </telerik:RadComboBox>
            </div>
            <div class="panelSeparator">
            </div>
            <div class="comboPanel">
                <asp:Label ID="Label2" runat="server" AssociatedControlID="ddlCities">City:</asp:Label>
                <telerik:RadComboBox RenderMode="Lightweight" ID="ddlCities" AllowCustomText="false" runat="server" EnableLoadOnDemand="true"
                    AutoPostBack="true" Width="186px" OnItemsRequested="RadComboBox3_ItemsRequested" Skin="Office2010Silver">
                </telerik:RadComboBox>
            </div>
            <div class="panelSeparator">
            </div>
        </div>
        <div class="panelBottom">
            <telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" BackgroundPosition="Center">
            </telerik:RadAjaxLoadingPanel>
        </div>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance