This is a migrated thread and some comments may be shown as answers.

After check done focus on textbox

1 Answer 25 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Loretta
Top achievements
Rank 1
Loretta asked on 07 Jun 2012, 08:32 PM
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?

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 08 Jun 2012, 02:03 PM
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.
Tags
Spell
Asked by
Loretta
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or