<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="SpellCheckServiceTest_Default" %>
<%@ Register TagPrefix="RadS" Namespace="Telerik.WebControls" Assembly="RadSpell.Net2" %>
<!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 id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
	<script type="text/javascript">
		function SpellCheckServiceCallbackFunction(sender, args)
		{
			var resultDump = "";
			for (var i=0; i<args.BadWords.length; i++)
			{
				var badWord = args.BadWords[i];
				resultDump += "badWord.textOffset = " + badWord.textOffset + "\n";
				resultDump += "badWord.wordString = " + badWord.wordString + "\n";
				resultDump += "badWord.suggestionsString = " + badWord.suggestionsString + "\n";
				resultDump += "\n";
			}
			resultDump += "\n";
			resultDump += "wordOffsets:" + args.WordOffsets.toString();
			alert("              Result after the Ajax spellcheck: \n\n" + resultDump);
		}
		function Check()
		{
			var spellCheckService = GetSpellCheckService("<%=SpellCheckService1.ClientID%>");
			var textToCheck = document.getElementById("<%=myTextBox.ClientID %>").value;
			spellCheckService.SpellCheck(textToCheck, SpellCheckServiceCallbackFunction);
		}
	</script>
	<RadS:SpellCheckService
		id="SpellCheckService1"
		runat="server" />
	<asp:TextBox ID="myTextBox" runat="server">Thiz iz some miztaken text</asp:TextBox>
	<input type="button" id="SpellCheckButton" value="Check!" onclick="javascript:Check();" />
</div>
</form>
</body>
</html>