The foreground code is as follows:
Copy Code code as follows:
<%@ Page language= "C #" autoeventwireup= "true" codefile= "Default.aspx.cs" inherits= "_default"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title>jquery Auto-completion function </title>
<script src= "Jquery.autocomplete/jquery-autocomplete/lib/jquery.js" type= "Text/javascript" ></script>
<script src= "Jquery.autocomplete/jquery-autocomplete/jquery.autocomplete.min.js" type= "Text/javascript" > </script>
<link href= "Jquery.autocomplete/jquery-autocomplete/jquery.autocomplete.css" rel= "stylesheet" type= "Text/css"/ >
<script src= "Jquery.autocomplete/jquery-autocomplete/demo/localdata.js" type= "Text/javascript" ></script >
<script type= "Text/javascript" >
$ (document). Ready (function () {
RaiseEvent ();
});
Request complete, callback function
function Rserver (arg, context) {
eval (ARG);
$ ("#sugest"). focus (). AutoComplete (data);
}
Initiating a data processing request to the server side
function RaiseEvent (ARG, context)
{
<%=clientscript.getcallbackeventreference (This, "Arg", "rserver", "context")%>;
}
</script>
<body>
<form id= "Form1" runat= "Server" >
<div>
<input type= "text" name= "text" id= "sugest" style= "width:200px"/>
</div>
</form>
</body>
And then there's the background code, and of course, here's just the analog data:
Copy Code code as follows:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Web;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Text;
public partial class _default:system.web.ui.page,icallbackeventhandler
{
protected void Page_Load (object sender, EventArgs e)
{
if (! IsPostBack)
{
}
}
Private StringBuilder Genstr ()
{
StringBuilder sbstr = new StringBuilder ();
Sbstr.append ("var data =");
Sbstr.append ("[");
Sbstr.append ("\" Aback\ ",");
Sbstr.append ("\" Back\ ",");
Sbstr.append ("\" Cback\ ",");
Sbstr.append ("\" english\ ",");
Sbstr.append ("\" Confidence\ ",");
Sbstr.append ("\" diligent\ ",");
Sbstr.append ("\" Honor\ ",");
Sbstr.append ("\" Delicious\ "");
Sbstr.append ("];");
return sbstr;
}
public string GetCallbackResult ()
{
Return Genstr (). ToString ();
}
public void RaiseCallbackEvent (String eventargument)
{
}
}