AutoCompleteExtender没有触发 [英] AutoCompleteExtender is not firing
本文介绍了AutoCompleteExtender没有触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的AutoCompleteExtender没有触发,我无法弄清楚我的代码有什么问题,请有人帮助我.谢谢.
Hi,
My AutoCompleteExtender is not firing I can''t figure out what is wrong with my code please someone help me. Thanks.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AutoCompleteWebService.aspx.cs" Inherits="WebService1.AutoCompleteWebService" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<!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:ScriptManager ID="sm1" runat="server" EnablePartialRendering="false" />
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" TargetControlID="txtFileName" ServiceMethod="GetSuggestions"
ServicePath="~/FileService.asmx" MinimumPrefixLength="1" runat="server" />
<asp:TextBox ID="txtFileName" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>
这是我的网络服务:
Here''s my webservice:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.IO;
namespace WebService1
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class FileService : System.Web.Services.WebService
{
[WebMethod]
public string[] GetSuggestions(string prefixText, int count)
{
DirectoryInfo dir = new DirectoryInfo("c:\\windows");
return dir
.GetFiles()
.Where(f => f.Name.StartsWith(prefixText))
.Select(f => f.Name)
.ToArray();
}
}
}
推荐答案
使用Toolkitscript
管理器而不是scriptmanager
.
请参阅我的文章,可能会为您提供指导你
将Ajax AutoCompleteExtender用于自动建议 [
Refer my article, might guide you
Using Ajax AutoCompleteExtender for autosuggest[^]
朋友们,
谢谢你的帮助.我找到了解决方法:D
我只是取消注释webservice asmx文件中的以下脚本.
Hi Friends,
Thanks for your help. I have found the solution :D
I just uncomment the below script in the webservice asmx file.
[System.Web.Script.Services.ScriptService]
这篇关于AutoCompleteExtender没有触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文