Checking Spelling in Different Controls
- 2 minutes to read
The ASPxSpellChecker component provides you with the capability to check the text in a wide range of text-aware controls. To get the list of controls supported by ASPxSpellChecker, see Supported Controls. This document describes methods for enabling spell check in your application. To learn about spell checking algorithms, and what should be done prior to starting spell check, refer to Spell Check Algorithms.
Enable Spell Checking in a Control
To specify the control to be processed by ASPxSpellChecker, perform the following steps:
- Set the ASPxSpellChecker.CheckedElementID property value of the ASPxSpellChecker control to the ID of the control to be checked.
To provide a correct ID for the spell checker’s client script, handle the ASPxSpellChecker.CheckedElementResolve event of the ASPxSpellChecker:
Call the ASPxClientSpellChecker.Check method in, for instance, the button’s client-side Click event handler:
function(s, e) { spellChecker.Check(); }
Enable Spell Checking in a Control Container
The ASPxSpellChecker component provides you with the capability to check the text of the controls placed onto the control container. You can do this by calling the ASPxClientSpellChecker.CheckElementsInContainer method in, for instance, the button’s client-side Click event handler:
function(s, e) {
spellChecker.CheckElementsInContainer(roundPanel.GetMainElement());
}
This code uses the ASPxClientControlBase.GetMainElement function, enabling access to the topmost object in the control’s object model. This object will be treated by a spell checker as the container that encompasses elements with text contents being checked.