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"};

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


 

posted @ 2009-01-06 16:58  Jerry Young  阅读(517)  评论(0编辑  收藏  举报