New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Custom Text Source

Spellchecking a text area and placing the corrected text in a different control.



RadSpell is not limited to spellchecking html elements only.  You can define a custom text source, that can provide text for RadSpell to spell check.

You need to define a JavaScript object with two methods: get_text() and set_text(param):

function VariableSpellSource() {
    this.get_text = function() {
        return "colourful mistakrn texr";
    this.set_text = function(newValue) {
        alert("The corrected text is: " + newValue);
  • DefaultCS.aspx
  • DefaultCS.aspx.cs
<%@ Page CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.Web.Examples.Spell.TextSource.DefaultCS"Language="C#" AutoEventWireup="true"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns=''>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container size-narrow">
        <script type="text/javascript">
            function DifferentControlsSource() {
                this.get_text=function() {
                    return $get('before').value;

                this.set_text=function(newValue) {
            var clientTextSource=new DifferentControlsSource();
            <p>Spellchecking a text area and placing the corrected text in a different control.</p>
            <textarea id="before" style="width:100%; height:100px;">Some mistakrn taxt</textarea>
            <textarea id="after" style="width:100%; height:100px;"></textarea>
        <telerik:RadSpell RenderMode="Lightweight" ID="spell2" runat="server" ClientTextSource="clientTextSource"
            ButtonText="Spellcheck and save to a different control"></telerik:RadSpell>

Support & Learning Resources

Find Assistance