[@又开一贴@]关于得用Ajax实现动态提示的功能,急死了...在线等!~~
原贴:http://community.csdn.net/Expert/topic/5503/5503329.xml?temp=.5765039
我想实现当在文件框中输入信息的时候动态从数据库里过滤的功能.
我装了:AjaxControlToolkit ASPAJAXExtSetup.msi ASPAJAXCTP.msi
是按照:http://blog.csdn.net/kRiSnI/archive/2007/04/18/1569125.aspx
的方法做的..按它的意思应该可以实现我需要的结果的.
Webservice.cs代码如下:
[WebMethod]
public string[] GetTextString(string prefixText, int count)
{
DataTable dt = Test.ReportView();
DataView dv = new DataView(dt);
dv.RowFilter = "编码 like '% " + prefixText + "% ' ";
DataTable dtnew = dv.ToTable();
List <string> list = new List <string> ();
foreach (DataRow dr in dtnew.Rows)
{
list.Add(dr[ "编码 "].ToString()+ "| "+dr[ "名称 "].ToString());
}
return list.ToArray();
}
------解决方案--------------------哦 楼主要的是自动完成啊,
看这个
http://mali.140.tofor.com/rizhi.asp?id=60
------解决方案--------------------自动完成?
这个有现成的控件,微软AJAX里带的
http://www.cnblogs.com/qc1984326/archive/2007/03/15/676003.html
------解决方案-------------------- <httpHandlers>
<remove verb= "* " path= "*.asmx "/>
<add verb= "* " path= "*.asmx " validate= "false " type= "System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 "/>
<add verb= "* " path= "*_AppService.axd " validate= "false " type= "System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 "/>
<add verb= "GET,HEAD " path= "ScriptResource.axd " type= "System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 " validate= "false "/>
</httpHandlers>
<compilation debug= "true ">
<assemblies>
<add assembly= "System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken= 31BF3856AD364E35 "/>
</assemblies>
</compilation>
在web.config里加上这个试试
------解决方案--------------------如果不是新建的ajax项目,而是引用dll的话,需要配置Web.config
------解决方案--------------------