就一个AJAX自动完成扩展的问题,搞了快1个月了,要疯了~救命!!
上个月做了一个小的类似于B2B的网站,总是觉得在产品查询和录入方便做的不太理想,于是想用AJAX的自动完成方式来做(像GOOGLE那样)。谁知道不用不知道,一用吓一跳,感觉是不错,可是N多的问题接踵而至。希望大家指导指导。谢谢。下面是我的页面代码
ASPX——————————————————————————
<%@ 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 ">
<html xmlns= "http://www.w3.org/1999/xhtml " >
<head runat= "server ">
<title> 无标题页 </title>
<script language= "javascript " type= "text/javascript " src= "lookup.js "> </script>
<script language= "jscript " type = "text/javascript ">
mainLoop = function()
{
val = escape(queryField.value);
if (lastVal != val)
{
var response =_Default.GetSearchItems(val);
showQueryDiv(response.value);
lastVal = val;
}
setTimeout( 'mainLoop() ', 100);
return true;
}
</script>
</head>
<body onload= "javascript:InitQueryCode( 'TextBox1 ') ">
<form id= "form1 " runat= "server ">
<div style= "text-align: center ">
<asp:TextBox ID= "TextBox1 " runat= "server " Width= "200px "> </asp:TextBox> <br />
<br />
<asp:Button ID= "Button1 " runat= "server " Text= "Button " /> <br />
<br />
<asp:TextBox ID= "TextBox2 " runat= "server "> </asp:TextBox> </div>
</form>
</body>
</html>
ASPX.CS————————————————————————————
using System;
using System.Data;
using System.Collections;
using System.ComponentModel;
using System.Configuration;
using System.Drawing;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using AjaxPro;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{