Edit this page

RadSpell Object

The following table lists significant members of the client-side RadSpell object:

Public Properties

Name Description Example
get_clientTextSource Gets the class of the client side text source object. See Example 1.
set_clientTextSource Sets the class of the client side text source object.
get_controlToCheck Gets the ID of the control to spell check.
set_controlToCheck Sets the ID of the control to spell check. See Example 2.
get_dialogOpener Returns the instance of the client-side DialogOpener object that handles that dialog opening/parameter passing processes.
set_useClassicDialogs When true is passed, a browser window will be used instead of a RadWindow. This can be useful if your site has the X-Frame-Options with value set to DENY. Browser popup blockers may prevent it from opening, however. See Example 7.
set_dialogOpener Sets the instance of the client-side DialogOpener object.
get_dictionaryLanguage Gets the dictionary language culture code.
set_dictionaryLanguage Sets the dictionary language culture code. See Example 3.
get_selectedLanguage Gets the language currently selected in the drop down displayed when the SupportedLanguages language property is set. See Example 4.
get_spellChecked Returns true if spell checking for the target control has been completed. (the OnClientCheckFinished event has been fired). See Example 5.
set_spellChecked Sets whether the spellcheck process is completed (true) or not (false). Note: Should not be used directly. It is used by the spellcheck validator.
get_textSource Returns the reference to the instance of the TextSource object that RadSpell is attached to.
set_textSource Attaches a custom TextSource object to the RadSpell object. See Example 6.

Example 1: Utilize spell's get_clientTextSource() property.

var spell = $find('<%= RadSpell1.ClientID %>');
alert(spell.get_clientTextSource);      

Example 2: Utilize spell's set_controlToCheck() property.

var spell = $find('<%= RadSpell1.ClientID %>');
spell.set_controlToCheck("<%= TextBox1.ClientID %>");
spell.startSpellCheck();            

Example 3: Utilize spell's set_dictionaryLanguage() property.

var spell = $find('<%= RadSpell1.ClientID %>');
spell.set_dictionaryLanguage('fr-FR');
alert('Dictionary Language: ' + spell.get_dictionaryLanguage());

Example 4: Utilize spell's get_selectedLanguage() property.

var spell = $find('<%= RadSpell1.ClientID %>');
alert(spell.get_selectedLanguage());                

Example 5: Utilize spell's get_spellChecked() property.

var spell = $find('<%= RadSpell1.ClientID %>');
if (spell.get_spellChecked()) {
    alert('Spell check has been run');
}

Example 6: Utilize spell's set_textSource() property.

function MyCustomTextSource() {
    this.get_text = function () {
        return $get("<%= TextBox1.ClientID %>").value;
    }
    this.set_text = function (text) {
        $get("<%= TextBox1.ClientID %>").value = text;
    }
}
function spellCheck() {
    var spell = $find('<%= RadSpell1.ClientID %>');
    spell.set_textSource(new MyCustomTextSource);
    spell.startSpellCheck();
}   

Example 7: Make RadSpell use browser windows instead of a RadWindow to accommodate the X-Frame-Options header

<script>
    function OnClientLoad(sender, args) {
        sender.set_useClassicDialogs(true);
    }
</script>
<telerik:RadSpell runat="server" ID="RadSpell1" OnClientLoad="OnClientLoad" ControlToCheck="Textbox1" />
<asp:TextBox ID="Textbox1" runat="server" Text="miztake" />

Public Methods

 

Name Description Example
spellCheck Launch the spellcheck process for the provided TextSource. See Example 7.
startSpellCheck Launch the spellcheck process See Example 8.

Example 8: Utilize spell's spellCheck() method.

var spell = $find('<%= RadSpell1.ClientID %>');
spell.spellCheck(new MyCustomTextSource());             

Example 9: Utilize spell's startSpellCheck() method.

var spell = $find('<%= RadSpell1.ClientID %>');
spell.startSpellCheck();                

Adding and Removing Client-Side Events

Name Description
add_clientCheckCancelled Add a handler to the OnClientCheckCancelled event
add_clientCheckFinished Add a handler to the OnClientCheckFinished event
add_clientCheckStarted Add a handler to the OnClientCheckStarted event
add_clientDialogClosing Add a handler to the OnClientDialogClosing event
remove_clientCheckCancelled Remove a handler from the OnClientCheckCancelled event
remove_clientCheckFinished Remove a handler from the ClientCheckFinished event
remove_clientCheckStarted Remove a handler from the ClientCheckStarted event
remove_clientDialogClosing Remove a handler from the ClientDialogClosing event