So I've seen some of the examples on the site, specifically http://www.telerik.com/help/aspnet/spell/spell_launching_upon_client-side_events.html 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: http://www.telerik.com/help/aspnet/spell/spell_spellchecking_in_htm,_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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <title>Spell Checker</title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <asp:ScriptManager ID="ScriptManager1" runat="server"> |
| </asp:ScriptManager> |
| <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> |
| </form> |
| <script type="text/javascript"> |
| function doSpellCheck() { |
| GetRadSpell('<%= RadSpell1.ClientID %>').startSpellCheck(); |
| } |
| window.onload = doSpellCheck |
| </script> |
| </body> |
| </html> |
Thanks!
Steven