<%@ Page Language="C#" AutoEventWireup="true" Codebehind="Default.aspx.cs" Inherits="ClientBasics._Default" %>

<%@ Register Assembly="RadSpell.Net2" Namespace="Telerik.WebControls" TagPrefix="radS" %>
<!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 runat="server">
  <title>Untitled Page</title>
</head>
<body>

  <script type="text/javascript">
//<!--
    function spellCheck()
    {
      var RadSpell1 = GetRadSpell('<%= RadSpell1.ClientID %>');
      RadSpell1.DictionaryLanguage = "fr-FR"; 
      var dialog = RadSpell1.GetDialogOpener(); 
      dialog.UseClassicDialogs = true;
      dialog.Language = "fr-FR"; 
      RadSpell1.StartSpellCheck(); 
    }

    function checkStarted(sender, args)
    {
      log("spell: " + sender.Id + " started for: " + sender.ControlToCheck);
      var RadSpell1 = GetRadSpell(sender.Id);
      log(sender.DictionaryLanguage);      
    /*  return sender.DictionaryLanguage == "en-US"; */
    }

    function checkFinished(sender, args)
    {
      log("spell: " + sender.Id + " finished for: " + sender.ControlToCheck);
    }

    function checkCancelled(sender, args)
    {
      log("spell: " + sender.Id + " cancelled for: " + sender.ControlToCheck);
    }

    function dialogClosing(sender, args)
    {
      log("spell: " + sender.Id + " dialog closing for: " + sender.ControlToCheck);
    }

    function wordIgnored(sender, args)
    {
      log("spell: " + sender.Id + " word ignored for: " + sender.ControlToCheck);
      getProperties(args); 
    }

    function log(text)
    {
        document.forms[0].taEvents.value += text + "\n";
    }
    
    function getProperties(obj)
    {
      for (prop in obj){
        log(prop + ": " + obj[prop] + "\n"); 
      }
    }
  
  //-->
  </script>

  <form id="form1" runat="server">
    <div>
      <radS:RadSpell ID="RadSpell1" runat="server" ButtonType="None" ControlToCheck="Text1"
        IsClientID="True" OnClientCheckCancelled="checkCancelled" OnClientCheckFinished="checkFinished"
        OnClientCheckStarted="checkStarted" OnClientDialogClosing="dialogClosing"></radS:RadSpell>
      <input id="Button1" type="button" value="Spell Check" onclick="spellCheck()" />
      <br />
      <input id="Text1" type="text" value="Thsi iss mispeld" />
      <br />
      <br />
      <textarea name="taEvents" id="taEvents" cols="54" rows="16"></textarea>
    </div>
  </form>
</body>

<script type="text/javascript">
  //<!--
    <%= RadSpell1.ClientID %>.AttachEvent('OnClientWordIgnored', 'wordIgnored');                        
  //-->
</script>

</html>
