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

Spellchecking Selections

Select some text in the textarea and click "Spellcheck".



Spellchecking a text selection is merely a matter of defining the appropriate text source implementation. 

In this example we define the TextSource's get_text() method to obtain the text from the currently selected text in the textarea. set_text() replaces the selection with the corrected text.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • scripts.js
<%@ Page  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <script type="text/javascript" src="Scripts.js"></script>
</head>
<body>
    <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">
        <h4>Select some text in the textarea and click "Spellcheck".</h4>
        <textarea id="textBox1" style="width:100%; height: 100px;">Thisz is a server side TextBox with some delibirate mistakees.</textarea>
        <br />
        <telerik:RadSpell RenderMode="Lightweight" ID="spell1" runat="server" ButtonType="None"></telerik:RadSpell>
        <button onclick="spellCheck('<%= spell1.ClientID %>'); return false;">
            Spellcheck</button>
        <br />
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance