Ajax AutoCompleteExtender在发布的应用程序中不起作用

时间:2020-05-20 09:14:17

标签: asp.net ajax autocomplete

我对此Ajax AutoCompleteExtender感到困惑。在我的本地环境中,它正在运行,但是当我将其上传到IIS服务器中时,它突然不起作用,并且我也不知道为什么。我当前正在使用IIS 10。

这是我的代码:

末尾:

<asp:TextBox ID="TextBox3" CssClass="rcorner" placeholder="Tell us about you DREAM HOUSE" runat="server" AutoPostBack="True"></asp:TextBox>
<cc1:AutoCompleteExtender ServiceMethod="SearchDreamHome"
   MinimumPrefixLength="1"
   CompletionInterval="1" EnableCaching="false" CompletionSetCount="10"
   TargetControlID="TextBox3"
   BehaviorID="AutoCompleteEx2"
   ID="AutoCompleteExtender1" runat="server">
</cc1:AutoCompleteExtender>

后端:

<System.Web.Script.Services.ScriptMethod(),
    System.Web.Services.WebMethod()>
    Public Shared Function SearchDreamHome(ByVal prefixText As String, ByVal count As Integer) As List(Of String)
        Dim conn As New SqlConnection With {.ConnectionString = "Server=dev.database.windows.net;Database=DB1;User=test;Pwd=123;"}

        Dim strsql As String = "select subcat from subcategory where subcat like '%" & prefixText & "%'"
        Dim cmd As SqlCommand = New SqlCommand(strsql, conn)
        conn.Open()
        Dim customers As List(Of String) = New List(Of String)
        Dim sdr As SqlDataReader = cmd.ExecuteReader
        While sdr.Read
            customers.Add(sdr("subcat").ToString)
        End While
        conn.Close()
        sdr.Close()
        Return customers
    End Function

这有什么问题吗?因为它可以在我的本地服务器上正常工作。

谢谢!

0 个答案:

没有答案