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

Error using SpellChecker in code behind

1 Answer 85 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Martin Sherene
Top achievements
Rank 1
Martin Sherene asked on 14 Jan 2011, 03:30 PM
I'm trying to use the Telerik.Web.UI.SpellChecker object to check some text server side, but keep getting the following error in the process: "No dictionary loaded. Set the DictionaryPath property from the spell checker settings or copy the dictionaries to ~/App_Data/RadSpell/".  I have two samples of code, both of which result in the same error being thrown.

Case 1:
SpellChecker spellChecker = new SpellChecker("~/App_Data/RadSpell");
spellChecker.Text = "Some sample text tecct";
SpellCheckErrors errors = spellChecker.Errors;

Case 2:
SpellChecker spellChecker = new SpellChecker("~/App_Data/RadSpell");
spellChecker.Text = "Some sample text tecct";
SpellCheckErrors errors = spellChecker.CheckText();

I've verified that the dictionary files do exist within the ~/App_Data/RadSpell directory, and they even get loaded into the SpellChecker object (I stepped through the debugger and used the immediate window to get values for spellChecker.CustomDictionarySource.DictionaryPath and spellChecker.CustomDictionarySource.Language:
spellChecker.CustomDictionarySource.DictionaryPath
"~/App_Data/RadSpell"
spellChecker.CustomDictionarySource.Language
"en-US"

These values seem to get set only after I have set the Text value of the SpellChecker object; prior to that (and just after creating the object), these values are null.

I'm using version 2010.3.1109.35 of the Telerik.Web.UI library for .Net 3.5.

Thanks for your help.

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 19 Jan 2011, 01:45 PM
Hi Martin,

You should set the path using the Server.MapPath method:

SpellChecker spellChecker = new SpellChecker(Server.MapPath("~/App_Data/RadSpell"));
spellChecker.Text = "Some sample text tecct";
SpellCheckErrors errors = spellChecker.Errors;



Greetings,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Spell
Asked by
Martin Sherene
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or