zoukankan      html  css  js  c++  java
  • Ajax Control Toolkits 2008遇到的问题

    Ajax Control Toolkits dll版本 3.0.20229.0

    在使用AutoCompleteExtender时使用WebService配置时总是不成功。好像根本没有走到后台的代码。

    大概代码如下:

    情况1:

    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

    <cc1:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" MinimumPrefixLength="1"

    ServiceMethod="GetMyFriends" ServicePath="http://localhost:10085/WebUI/WS/WebSearch.asmx"

    TargetControlID="TextBox1" ></cc1:AutoCompleteExtender>

    ===============================================

    [WebMethod]

    public string[] GetMyFriends(string prefixText,int count)

    {

       return new string[]{"Hello","World","Mary","Kay"};

    }


    情况2:

    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

    <cc1:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" MinimumPrefixLength="1"

    ServiceMethod="GetMyFriends" ServicePath="http://localhost:10085/WebUI/WS/WebSearch.asmx"

    TargetControlID="TextBox1" UseContextKey="True" ContextKey="123"></cc1:AutoCompleteExtender>

    ===============================================

    [WebMethod]

    public string[] GetMyFriends(string prefixText,int count,string contextKey)

    {

       return new string[]{"Hello","World","Mary","Kay"};


    但是可以使用一种类似本地代码的WEBSERVICE

    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

    <cc1:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" MinimumPrefixLength="1"

    ServiceMethod="GetCompletionList" CompletionSetCount="10" ServicePath=""

    TargetControlID="TextBox1" UseContextKey="True" ContextKey="123"></cc1:AutoCompleteExtender>

    ===============================================

    [System.Web.Services.WebMethodAttribute(),System.Web.Script.Services. ScriptMethodAttribute()]

    public static string[] GetCompletionList(string prefixText,int count, string contextKey)

    {

       return new string[]{"Hello","World","Mary","Kay"};

    我在网上找一圈没找到具体的原因,把自己测试的结果发上来共大家参考!


  • 相关阅读:
    正则表达式(转)
    Collections中的shuffle()方法
    Fermat定理
    哈希算法(转)
    Hungarian method (匈牙利算法)----解决指派问题(转)
    蒙塔卡洛模拟
    线程的礼让
    线程间的沟通
    安装rlwrap
    yum切到光盘源
  • 原文地址:https://www.cnblogs.com/kaixuanpisces/p/1370501.html
Copyright © 2011-2022 走看看