Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 自动建议使用AJAX_C#_Asp.net_Ajaxcontroltoolkit - Fatal编程技术网

C# 自动建议使用AJAX

C# 自动建议使用AJAX,c#,asp.net,ajaxcontroltoolkit,C#,Asp.net,Ajaxcontroltoolkit,我正在尝试为文本框实现自动建议。我已经检查了其他帖子,似乎没有任何效果。我在web应用程序和网站中都尝试过。请找出我代码中的错误。当我在文本框中键入字母时,什么都没有发生。我可以在浏览器中看到web服务结果 delete.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Delete.aspx.cs" Inherits="WebApplication2.Delete" %> <%@ Reg

我正在尝试为文本框实现自动建议。我已经检查了其他帖子,似乎没有任何效果。我在web应用程序和网站中都尝试过。请找出我代码中的错误。当我在文本框中键入字母时,什么都没有发生。我可以在浏览器中看到web服务结果

delete.aspx

  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Delete.aspx.cs"
   Inherits="WebApplication2.Delete" %>
  <%@ Register TagPrefix="ajaxToolkit" Namespace="AjaxControlToolkit" 
  Assembly="AjaxControlToolkit"%>
<!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 id="Head1" runat="server">
    <title>Untitled Page</title>
    </head>

<body>  
  <form id="form1" runat="server">  
    <div> 
     <asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" 
      EnablePartialRendering="true" 
      runat="server">
     </asp:ScriptManager>  
           <asp:TextBox ID="myTextBox" runat="server" Width="400px" ></asp:TextBox> 
           <ajaxToolkit:AutoCompleteExtender  runat="server"    ID="autoComplete1" 
             TargetControlID="myTextBox"
             ServiceMethod="Information"
             ServicePath="~/WebService1.asmx"
             OnClientItemOut="Information"
             MinimumPrefixLength="1" 
             CompletionInterval="1000"
             EnableCaching="true"
             CompletionSetCount="5"   
             ShowOnlyCurrentWordInCompletionListItem="true">
               </ajaxToolkit:AutoCompleteExtender> 
        </div>  
         </form>
         </body>

}

尝试使用ToolkitScriptManager,而不是asp.net ScriptManager,如下所示:

<ajaxToolkit:ToolkitScriptManager ID="sm1" runat="server" />

从您的ASPX中删除行
onclientemout=“Information”
。您的JavaScript中没有定义信息处理程序

然后将
[ScriptService]
属性添加到Web服务


检查正在发生的事情的便捷工具是。它将显示发送到服务器的请求和响应

我很想知道你为什么没有考虑jquery自动完成。你能给我提供链接吗?我会试试。我用@Wouter de Kort changes尝试了这个。它不起作用。你得到的400是什么?在页面本身上?没有。在fiddler中的响应。我用genric handler尝试了jquery。它工作正常。谢谢。
<ajaxToolkit:ToolkitScriptManager ID="sm1" runat="server" />