locked
AutoCompleteExtender not working when deployed to server RRS feed

  • Question

  • User-281162034 posted

    Hi

    I have searched and searched but cannot find the setting that allows my AutoCompleteExtender to function when deployed to the server.  It works as desired on my computer.  Also, other Ajax controls (always visible and AjaxFileUpload) I am using work correctly on the server.

    I am using AjaxControlToolkit.16.1.0.0 and Visual Studio 2015 Express.

    Thanks in advance for any help.

    markup for the AutoCompleteExtender 

    <asp:Panel ID="RenamePanel" runat="server" Visible="false">
    <table id="Table1" runat="server">
    <tr>
    <td>
    <asp:Image ID="ImageRename" runat="server"
    Height="400px"
    style='border:1px solid #000000'/>
    </td>
    <td style="vertical-align:bottom">
    <asp:label ID="RenameImageName" runat="server"></asp:label>
    <br /><br />
    <asp:TextBox ID="RenameTextBox" runat="server" width="1000px" MaxLength="275"> </asp:TextBox>
    <br />
    <asp:Button ID="RenameButton" runat="server"
    onclientclick="RenameImage"
    Text="Rename Image!" />
    </td>
    </tr>
    </table>
    <cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
    TargetControlID="RenameTextBox"
    ServiceMethod="GetNameList"
    ServicePath="../WebService.asmx"
    MinimumPrefixLength="2"
    CompletionInterval="100"
    CompletionSetCount="10">
    </cc1:AutoCompleteExtender>
    </asp:Panel>

    code in WebService.asmx file

    <System.Web.Script.Services.ScriptService()>
    <WebService(Namespace:="http://mywebsite.net/")>
    <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
    Public Class WebService
    Inherits System.Web.Services.WebService

    <WebMethod()>
    Public Function GetNameList(ByVal prefixText As String, ByVal count As Integer) As String()

    Dim conString As String = General.ConString

    Dim queryString As String = ""
    queryString = "SELECT DISTINCT TOP 11 Name FROM Table_images " _
    & "WHERE Name like '%" & prefixText & "%' ORDER BY Name"
    Dim adapt As New Data.SqlClient.SqlDataAdapter(queryString, conString)
    Dim table As New Data.DataTable
    adapt.Fill(table)
    Dim row As Data.DataRow
    Dim items As New List(Of String)

    If table.Rows.Count > 0 Then
    For Each row In table.Rows
    items.Add(HttpUtility.HtmlDecode(row(0)))
    Next
    End If

    Return items.ToArray()

    End Function

    and finally my update to the web.config file

    <system.webServer>
    <handlers>

    <!-- added for ajax -->
    <add name="AjaxFileUploadHandler" verb="POST" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit" />
    <!-- added for ajax -->

    </handlers>

    Friday, May 13, 2016 7:10 PM

All replies

  • User61956409 posted

    Hi,

    Welcome to ASP.NET forum.

    I have searched and searched but cannot find the setting that allows my AutoCompleteExtender to function when deployed to the server.  It works as desired on my computer.  Also, other Ajax controls (always visible and AjaxFileUpload) I am using work correctly on the server.

    You could try to use F12 developer tools Network tool to check if the request could be sent to Web service.

    Best Regards,

    Fei Han

    Saturday, May 14, 2016 6:05 AM
  • User-281162034 posted

    HI

    I used F12 which exposed Namespace System.  There are about 2600 lines of code there.  What would I be looking for?

    Saturday, May 14, 2016 11:36 AM
  • User61956409 posted

    Hi,

    I used F12 which exposed Namespace System.  There are about 2600 lines of code there.  What would I be looking for?

    Please find and check the status of the request to WebService.asmx/GetNameList method.

    Best Regards,

    Fei Han

    Wednesday, May 18, 2016 6:53 AM
  • User-281162034 posted

    HI Fei

    Thanks for your reply.  I did some more exploring and found https://blogs.msdn.microsoft.com/visualstudio/2015/05/04/introducing-visual-studios-network-tool/  which explains how to use the network tool.  Since I am using Visual Studio Community, the network performance tool is not available (greyed out).  So, it would appear that F12 will not work for me.

    Am I looking in the correct spot?  If yes, then is there some where else I can look.

    Thanks for any help.

    Thursday, May 26, 2016 2:02 PM
  • User348142989 posted

    I have found an answer within the web.config file.

    added

    <webServices>
    <protocols>
    <add name="HttpGet"/>
    <add name="HttpPost"/>
    </protocols>
    </webServices>

    inside <system.web></system.web> tags and the autocomplete now work on both my development machine and also on the server.

    Thursday, January 12, 2017 12:18 AM