A newer version of this page is available. Switch to the current version.

ASPxSpellChecker.WordAdded Event

Fires when a word is added to the custom dictionary.

Namespace: DevExpress.Web.ASPxSpellChecker

Assembly: DevExpress.Web.ASPxSpellChecker.v18.2.dll

Declaration

public event WordAddedEventHandler WordAdded
Public Event WordAdded As WordAddedEventHandler

Event Data

The WordAdded event's data class is WordAddedEventArgs. The following properties provide information specific to this event:

Property Description
Word Gets a word added to the dictionary.

Remarks

Use the WordAdded event to save the custom dictionary to an arbitrary location. Currently, the custom dictionary is stored in a session and cannot be shared between users. Collaboration can be established by handling two events - the WordAdded event to save a changed dictionary and the ASPxSpellChecker.CustomDictionaryLoading event to load the dictionary.

The added word is available via the WordAddedEventArgs.Word property.

This code illustrates that you can handle the ASPxSpellChecker.WordAdded event to save an updated custom dictionary to the original location. The ASPxSpellChecker.GetCustomDictionary method enables you to access a custom dictionary that is currently in use.

using DevExpress.Web.ASPxSpellChecker;
using DevExpress.XtraSpellChecker;
        protected void ASPxSpellChecker1_WordAdded(object sender, WordAddedEventArgs e) {
            ASPxSpellChecker checker = sender as ASPxSpellChecker;
            SpellCheckerCustomDictionary dic = checker.GetCustomDictionary();
            if (dic != null) {
                StringBuilder stb = new StringBuilder();
                for (int i = 0; i < dic.WordCount; i++)
                    stb.AppendLine(dic[i]);
                using (StreamWriter writer = new StreamWriter(userDictPath)) {
                    writer.Write(stb.ToString());
                }
            }
        }
See Also