【问题标题】:Auto-complete method does not get called不会调用自动完成方法
【发布时间】:2014-02-18 16:56:46
【问题描述】:

我不知道出了什么问题,这是我第一次搞砸这个。查看 ajax 示例,一切都应该正常工作.. 但我的方法没有被调用。

我没有使用网络服务,并且想从页面方法返回我的建议。

<asp:TextBox ID="searchBox" runat="server" CssClass="searchTextBox"></asp:TextBox>

<asp:AutoCompleteExtender ID="searchBox_AutoCompleteExtender" runat="server"
  DelimiterCharacters="" Enabled="True" ServiceMethod="_get_Suggestions"
  TargetControlID="searchBox">
</asp:AutoCompleteExtender>

页面方法:

Private Function _get_Suggestions(prefixText As String, count As Int16) As String()
    Dim array() As String = {"doggy", "catty", "fishy"}
    Return array
End Function

也试过了:

<WebMethod()> <Script.Services.ScriptMethod()> Public Shared Function _get_Suggestions(prefixText As String, count As Int16) As String()

【问题讨论】:

    标签: asp.net ajax autocomplete ajaxcontroltoolkit


    【解决方案1】:

    我的 Extender AND 方法在我的母版页上。在对类似问题进行了一些提示之后,我似乎无法在后面的母版页代码上使用我的页面方法。

    我必须将页面方法放在我的内容页面中,而扩展器本身可以放在我的母版页中。

    为什么?没有线索...也许有人可以详细说明以改进此答案。

    【讨论】:

      猜你喜欢
      • 2018-01-14
      • 2015-08-20
      • 2018-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多