GetRadSpell(clientID) not available during window.onload?

3 posts, 1 answers
  1. Steven D'Anna
    Steven D'Anna avatar
    2 posts
    Member since:
    Jan 2009

    Posted 22 Dec 2009 Link to this post

    So I've seen some of the examples on the site, specifically and I can invoke the spell checker just fine on say a button click or some other UI event such as onblur of a textbox.  What I want to do is to spell check immediately when the page loads (without user interaction... steps described elsewhere on the site albeit for a previous version of the spell component:,_html,_and_asp_files.html)

    For some reason I can't get the GetRadSpell() function to return an instance of the Spell Editor like what happens when I click it from a button.  Is it a timing issue?  Can I not do this on the window.load event of the browser?  Is there a way to get my desired result?  My code is below.

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SpellChecker.aspx.cs" Inherits="EditorExample.SpellChecker" %>  
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>  
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">  
    <html xmlns="">  
        <title>Spell Checker</title>  
        <form id="form1" runat="server">  
            <asp:ScriptManager ID="ScriptManager1" runat="server">  
            <input type="text" id="test" value="misstake"/>  
            <telerik:RadSpell ID="RadSpell1" runat="server" ControlToCheck="test" IsClientID="True"  
                SupportedLanguages="en-US,English" />  
            <span onclick="doSpellCheck()">Click me to spell check</span>  
        <script type="text/javascript"
            function doSpellCheck() { 
                GetRadSpell('<%= RadSpell1.ClientID %>').startSpellCheck(); 
            window.onload = doSpellCheck 

  2. Answer
    Martin avatar
    585 posts

    Posted 23 Dec 2009 Link to this post

    Hi Steven D'Anna,

    In ASP.NET AJAX it is recommended to use the Sys.Application.load function of the framework instead of JavaScript window.onload function. Although both functions are supposed to execute when page loads, Sys.Application.load function of ASP.NET AJAX handles certain problems that usually arise when window.onload has been used. I suggest that you use Sys.Application.load because it will execute after the controls have been initialized on the page and I believe that you will be able to spellcheck successfully. You may refer to the following article as well:


    Kind regards,
    Martin Ivanov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Steven D'Anna
    Steven D'Anna avatar
    2 posts
    Member since:
    Jan 2009

    Posted 23 Dec 2009 Link to this post

    That worked like a charm!  Thanks for the response.
Back to Top