locked
AutoCompleteExtender quit working RRS feed

  • Question

  • User-929591473 posted

    Hi,

    I adopted an old application.  The AutoCompleteExtender has recently quit working.  Why would this happen?  The code has not changed in over 2 years?  

    Here is part of the source (the part I thought would help find a solution anyway) - 

    <asp:TextBox runat="server" ID="autoCompleteTextBox" Width="300" />
    
    <ajaxToolkit:AutoCompleteExtender runat="server" BehaviorID="AutoCompleteEx" ID="autoComplete1" 
    TargetControlID="autoCompleteTextBox" ServicePath="http://ciifapps/logins/MyWebService.asmx" 
    ServiceMethod="GetCompletionList2" UseKeyValuePairs="True" FirstRowSelected="True"
    OnClientHidden="clientHidden" 
    OnClientItemSelected ="clientSelected" MinimumPrefixLength="2" OnClientShowing="clientShowing"
    CompletionInterval="500" EnableCaching="true" CompletionSetCount="20"
    CompletionListCssClass="autocomplete_completionListElement" 
    CompletionListItemCssClass="autocomplete_listItem" DelimiterCharacters=",;"
    CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" OnClientPopulating="clientPopulating" />

    Here is the code behind - 

    Imports Utilities
    Imports System.Data
    Imports System.Data.SqlClient
    Imports System.Data.Odbc
    
    Partial Class Ajax
        Inherits BasePage
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
            Me.Master.TabGroup = Utilities.TabGroup.UserAccounts
    
            Dim css As New HtmlLink
            css.Href = "CSS/StaffLookup.css"
            css.Attributes("rel") = "stylesheet"
            css.Attributes("type") = "text/css"
            css.Attributes("media") = "all"
            Page.Header.Controls.Add(css)
    
            Dim sbd As New StringBuilder("")
            With sbd
                .Append("function requeryForm() {")
                .Append(ClientScript.GetPostBackEventReference(Me.refreshButton, ""))
                .Append(";return true;}")
            End With
            ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType, "K001", sbd.ToString, True)
    
            Dim EmpID As Int32 = 0
    
            If Not Request.QueryString("EmpID") Is Nothing Then
                EmpID = Convert.ToInt32(Request.QueryString("EmpID"))
                Me.SqlDataSource1.SelectParameters(0).DefaultValue = EmpID
            End If
    
        End Sub
    
        Protected Sub refreshButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
            Me.FormView1.DataBind()
        End Sub
    
        Protected Sub deleteLink_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    
    
            Dim cnn As New SqlConnection(Utilities.GetConnectionString("main"))
            cnn.Open()
            Dim s As String = ""
            Dim recs As Int32 = 0
            Dim Username As String = CType(sender, LinkButton).CommandArgument
            Dim cmd As New System.Data.SqlClient.SqlCommand("DELETE FROM tblUser WHERE UsrLogin=@UsrLogin", cnn)
            cmd.Parameters.AddWithValue("@UsrLogin", Username)
            recs = cmd.ExecuteNonQuery()
            cmd.Dispose()
    
    
            ' ------------------------------------------------------------------------------------------------------
            Dim cnn2 As System.Data.Odbc.OdbcConnection
            Dim cmd2 As System.Data.Odbc.OdbcCommand
            Dim i As Int32 = 0
    
            cnn2 = New System.Data.Odbc.OdbcConnection(GetConnectionString("access95mdw"))
            cnn2.Open()
    
            i = 0
            cmd2 = New System.Data.Odbc.OdbcCommand()
            cmd2.Connection = cnn2
            cmd2.CommandText = "DROP USER [" & Username & "]"
            Try
                i = cmd2.ExecuteNonQuery()
            Catch ex As Exception
                ' Handle Errors
            End Try
            cmd2.Dispose()
            cnn2.Close()
            cnn2.Dispose()
    
    
            cnn2 = New System.Data.Odbc.OdbcConnection(GetConnectionString("access2kmdw"))
            cnn2.Open()
            cmd2 = New System.Data.Odbc.OdbcCommand()
            i = 0
            cmd2.Connection = cnn2
            cmd2.CommandText = "DROP USER [" & Username & "]"
            Try
                i = cmd2.ExecuteNonQuery()
            Catch ex As Exception
                ' Handle Errors
            End Try
    
            cmd2.Dispose()
            cnn2.Close()
            cnn2.Dispose()
            ' ------------------------------------------------------------------------------------------------------
    
            cnn.Close()
            cnn.Dispose()
    
            If s.Length > 0 Then
                Me.statusLabel.Text = s
            Else
                Response.Redirect("Ajax.aspx")
            End If
    
    
        End Sub
    
        Protected Sub changePasswordLink_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    
            Response.Redirect("ChangePassword.aspx?EmpID=" & CType(sender, LinkButton).CommandArgument)
    
        End Sub
    
    
        Protected Sub addLoginLinkButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    
            Dim c As Object
            Dim url As String = "LoginAdd.aspx"
    
            c = Me.FormView1.FindControl("EmpIDLabel")
            url &= "?EmpID=" & Server.UrlEncode(CType(c, Label).Text)
    
            Response.Redirect(url)
    
        End Sub
    
    
    End Class
    

    Any ideas why this code would just stop working? 

    Thank you in advance for any help.

    Best regards,

    Mark

    Tuesday, April 25, 2017 2:09 AM

All replies

  • User-1838255255 posted

    Hi mahskeet,

    After read your code and description, I can not found some error form your code. But I have some suggestions for you:

    1. Have you get the expect information or some error message? About how it stop working, please give us a detailed description.

    2. You could add a breakpoint at the code behind, check it stops which line or which function. Please pay more attention to this function(GetCompletionList2);

    3. jQuery Ajax AutoComplete also is a good choice to achieve this function, for more detail, please check this sample:

    Populate jQuery AutoComplete TextBox from Database using Web Service in ASP.Net:

    https://www.aspsnippets.com/Articles/Populate-jQuery-AutoComplete-TextBox-from-Database-using-Web-Service-in-ASPNet.aspx 

    Best Regards,

    Eric Du

    Tuesday, April 25, 2017 9:54 AM
  • User-929591473 posted

    Hi Eric,

    There is no error message with the page, the textbox will just not autofill which means the user cannot select a name to continue.  The code has not changed so it was working (and has been for many years).   I tried restarting the server last night, but that did not help.

    Best regards,

    Mark

    Tuesday, April 25, 2017 11:03 AM
  • User-1838255255 posted

    Hi mahskeet,

    According to your description, I am not clear what did you do at that moment. Like update OS, update Ajax toolkit ....

    As far as I know, if you make change of these places, it will make the Ajax toolkit and framework not match. So it don't work.

    I hope you could add a breakpoint to check if trigger this method, or check some error message in browser F12- console panel.

    Best Regards,

    Eric Du

      

    Monday, May 8, 2017 2:38 AM
  • User-929591473 posted

    Hi Eric,

    Other than maybe a few updates ran on the server, nothing else has been updated.  The code has not changed in over 2 years.  That's the strange thing.  

    Best regards,

    Mark

    Monday, May 8, 2017 10:56 AM
  • User-1838255255 posted

    Hi mahskeet,

    Could you tell us what update you do, I guess this will affect the code work, so I hope you could give us a detailed description!

    Best Regards,

    Eric Du 

    Wednesday, May 10, 2017 9:30 AM