Home / Community & Support / Knowledge Base / RadControls for ASP.NET and ASP.NET AJAX / Spell / Starting spell check on client side events

Starting spell check on client side events

Article Info

Rating: 3

Article information

Article relates to

 RadSpell Classic v.3+,RadSpell "Prometheus" 

Created by

 Tsvetelina, Telerik

Last modified

 2008/04/14

Last modified by

 Georgi Popivanov

HOW-TO
Start spell check on client side events.

DESCRIPTION
It is a common goal to start the process of spell checking when a ceratin client-side event is fired. This process is started by means of a JavaScript function and you can easily configure the RadSpell control to start it on a client-side event by calling that function. This KB article will guide you through the steps of achieving that result with the onBlur event of the Textbox control. While we use a certain control and event for the purpose of our demonstration, you can easily apply these steps on any other control and event.

SOLUTION

The example that we will go through will setup a TextBox control that automatically checks the spelling of its text once a user finishes typing and moves on to another control.


 

  1. Let us assume that the control you want to check has ID "targetText". Set the ControlToCheck property of the RadSpell object to "targetText" and the ButtonType property to "None": 
    <radS:RadSpell id="spell" Runat="server" ControlToCheck="targetText" ButtonType="None">     
    </radS:RadSpell>    
     

     
  2. Define a JavaScript function that will start the process of spell checking:
    <script language="javascript">                    
    function spellCheck()                    
    {                    
           GetRadSpell('<%= spell.ClientID %>').StartSpellCheck();                      
    }                     
    </script>    


    Please pay attention to the <% %> block - it gets the correct client id of the RadSpell object.
     
     
  3. Configure the TextBox to call the JavaScript function you just defined when the onBlur event fires: 
    <asp:TextBox id="targetText" onblur="javascript: spellCheck();" runat="server">     
       this is a mistakr     
    </asp:TextBox>    

     



  1. Let us assume that the control you want to check has ID "targetText". Set the ControlToCheck property of the RadSpell object to "targetText" and the ButtonType property to "None": 
    <telerik:RadSpell id="spell" Runat="server" ControlToCheck="targetText" ButtonType="None">        
    </telerik:RadSpell>     
     

     
  2. Define a JavaScript function that will start the process of spell checking:
    <script language="javascript">                 
        function spellCheck()                 
        {                   
            var spell = $find("<%= spell.ClientID %>");     
            spell.startSpellCheck();                   
        }                  
    </script>   

    Please pay attention to the <% %> block - it gets the correct client id of the RadSpell object. 
     
     
  3. Configure the TextBox to call the JavaScript function you just defined when the onBlur event fires:
    <asp:TextBox id="targetText" onblur="javascript: spellCheck();" runat="server">     
       this is a mistakr     
    </asp:TextBox>    

Comments

  • JohnnyAdams , Dec 21, 2006

    Excellent -- I used this information to solve another problem (getting it to run when the form loads)

If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.