<%@ Register Assembly="ASPNetSpell" Namespace="ASPNetSpell" TagPrefix="ASPNetSpell" %> <!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></title> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server">Helllo Worlb</asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Search" /> <br /> <asp:Label ID="Label1" runat="server">Did You Mean :</asp:Label> <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click"></asp:LinkButton> </div> </form> </body> </html>
using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Prerender(object sender, EventArgs e) { ASPNetSpell.SpellChecker SpellEngine = new ASPNetSpell.SpellChecker(); SpellEngine.DictionaryPath = Server.MapPath("ASPNetSpellInclude/dictionaries"); SpellEngine.LoadDictionary("English (International)"); SpellEngine.LoadCustomDictionary("custom.txt"); LinkButton1.Text = SpellEngine.DidYouMean(TextBox1.Text); Label1.Visible = (LinkButton1.Text != ""); } protected void LinkButton1_Click(object sender, EventArgs e) { TextBox1.Text = LinkButton1.Text; } }
Imports System.Collections.Generic Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls Public Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Prerender(sender As Object, e As EventArgs) Dim SpellEngine As New ASPNetSpell.SpellChecker() SpellEngine.DictionaryPath = Server.MapPath("ASPNetSpellInclude/dictionaries") SpellEngine.LoadDictionary("English (International)") SpellEngine.LoadCustomDictionary("custom.txt") LinkButton1.Text = SpellEngine.DidYouMean(TextBox1.Text) Label1.Visible = (LinkButton1.Text <> "") End Sub Protected Sub LinkButton1_Click(sender As Object, e As EventArgs) TextBox1.Text = LinkButton1.Text End Sub End Class