After check done focus on textbox

2 posts, 0 answers
  1. Loretta
    Loretta avatar
    1 posts
    Member since:
    May 2012

    Posted 07 Jun 2012 Link to this post

    I am trying to set focus on the textbox control targeted by a RadSpell control after the check is done, whether it has been cancelled or finished or completed, using client-side javascript.

    Putting .focus() in the client functions does not seem to work, the focus always returns to the pushbutton.
    And after googling at length, I have found no example of how to do this.

    Could someone please help me out?
  2. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 08 Jun 2012 Link to this post

    Hello,

    You can use the following code to set the focus:

    <telerik:RadSpell ID="RadSpell1" runat="server" ControlsToCheck="TextBox1"  OnClientCheckFinished="spellCheckFinished" />
    <asp:TextBox ID="TextBox1" runat="server"/>
     
    <script type="text/javascript">
    function spellCheckFinished(sender, args)
    {
        setTimeout(function () {
            $get("TextBox1").focus();
        }, 1000);
    }
    </script>

    Greetings,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top