New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

RadSpell Object

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

Public Properties

NameDescriptionExample
get_clientTextSourceGets the class of the client side text source object.See Example 1.
set_clientTextSourceSets the class of the client side text source object.
get_controlToCheckGets the ID of the control to spell check.
set_controlToCheckSets the ID of the control to spell check.See Example 2.
get_dialogOpenerReturns the instance of the client-side DialogOpener object that handles that dialog opening/parameter passing processes.
set_useClassicDialogsWhen 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_dialogOpenerSets the instance of the client-side DialogOpener object.
get_dictionaryLanguageGets the dictionary language culture code.
set_dictionaryLanguageSets the dictionary language culture code.See Example 3.
get_selectedLanguageGets the language currently selected in the drop down displayed when the SupportedLanguages language property is set.See Example 4.
get_spellCheckedReturns true if spell checking for the target control has been completed. (the OnClientCheckFinished event has been fired).See Example 5.
set_spellCheckedSets whether the spellcheck process is completed (true) or not (false). Note: Should not be used directly. It is used by the spellcheck validator.
get_textSourceReturns the reference to the instance of the TextSource object that RadSpell is attached to.
set_textSourceAttaches a custom TextSource object to the RadSpell object.See Example 6.

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

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

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

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

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

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

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

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

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

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

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

JavaScript
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

ASP.NET
<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

 

NameDescriptionExample
spellCheckLaunch the spellcheck process for the provided TextSource.See Example 7.
startSpellCheckLaunch the spellcheck processSee Example 8.

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

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

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

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

Adding and Removing Client-Side Events

NameDescription
add_clientCheckCancelledAdd a handler to the OnClientCheckCancelled event
add_clientCheckFinishedAdd a handler to the OnClientCheckFinished event
add_clientCheckStartedAdd a handler to the OnClientCheckStarted event
add_clientDialogClosingAdd a handler to the OnClientDialogClosing event
remove_clientCheckCancelledRemove a handler from the OnClientCheckCancelled event
remove_clientCheckFinishedRemove a handler from the ClientCheckFinished event
remove_clientCheckStartedRemove a handler from the ClientCheckStarted event
remove_clientDialogClosingRemove a handler from the ClientDialogClosing event