Small try jquery's AutoComplete plugin _jquery

Source: Internet
Author: User
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)
{
}
}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.