1

Question tells all. I got an AutoCompleteExtender that works as a clock on my pc running under VisualWebDeveloper's debug virtual machine but when I publish files on publication server it doesn't work... This is the code i use in codebehind:

<System.Web.Script.Services.ScriptMethod(), System.Web.Services.WebMethod(EnableSession:=True)> Public Shared Function SearchCustomers(ByVal prefixText As String, ByVal count As Integer) As List(Of String)

    Dim conn As SqlConnection = New SqlConnection
    conn.ConnectionString = ConfigurationManager.ConnectionStrings("AFTERSALES").ConnectionString
    Dim cmd As SqlCommand = New SqlCommand
    cmd.CommandText = "SELECT an_descr1, an_descr2 FROM anagrafica WHERE an_azienda = @azienda AND an_descr1 + ' ' + an_descr2 LIKE '%' + @SearchText + '%'"
    cmd.Parameters.AddWithValue("@SearchText", prefixText)
    cmd.Parameters.AddWithValue("@azienda", HttpContext.Current.Session("CODazienda").ToString)
    cmd.Connection = conn
    conn.Open()
    Dim customers As List(Of String) = New List(Of String)
    Dim sdr As SqlDataReader = cmd.ExecuteReader
    While sdr.Read
        customers.Add(Trim(sdr("an_descr1").ToString & " " & sdr("an_descr2").ToString))
    End While
    conn.Close()
    conn = Nothing
    Return customers
End Function

And here following are the controls i use in aspx search page (toolkitscriptmanager is in masterpage):

<asp:TextBox ID="TextBox1" runat="server" Width="300px" AutoPostBack="True"></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="TextBox1" ServiceMethod="SearchCustomers"
MinimumPrefixLength="2" CompletionInterval="100" EnableCaching="false" CompletionSetCount="10" FirstRowSelected = "false"></ajaxToolkit:AutoCompleteExtender>
Supermac
  • 11
  • 3
  • What does "doesn't work" mean? Are you getting an error? What error? Is it acting funny? How is it acting funny? etc. – Becuzz Jan 09 '15 at 15:54
  • Simply it doesn't work.... it should show a frame under textbox with results of the query you can see in code i posted but is shows anything, no frame, nothing... – Supermac Jan 09 '15 at 15:57
  • Not even a javascript error? – Becuzz Jan 09 '15 at 15:58
  • none, nothing of nothing – Supermac Jan 09 '15 at 16:04
  • I can add another detail: using Firebug I see that when I type second char in textbox, a post is sent to the server... but then nothing happens... – Supermac Jan 09 '15 at 16:26
  • Still Firebug in Net/Javascript panel shows me the GET scriptresource.axd answers to my posts but in Headings/Reply headings it shows the message "The request was resolved directly from the cache, so we have no response from the server. See below for the cached response." ??? – Supermac Jan 09 '15 at 16:37
  • Clear your browser cache and try again and watch the response in Firebug. – Becuzz Jan 09 '15 at 17:02
  • same behavior... if I give yoy user&pwd would you try to see if is possible to understand something from rendered page? – Supermac Jan 09 '15 at 23:04
  • When I tried it it gave me a response with no records in it (so there is nothing to show for the autocomplete). It looks like there may be a problem with your data or query, such that it works on your machine, but is missing something in production. After typing something it also gave me an error that said "In database non è presente nessun record da visualizzare! " which, if I am reading that right, says there aren't any records in the database to show. The autocomplete extender seems to be working ok so I'm leaning towards a data / database issue. – Becuzz Jan 13 '15 at 14:35
  • I'll try to check the query and data related. Thank you a lot, your help is precious! – Supermac Jan 13 '15 at 16:29
  • No problem. Also, I would deactivate that account or something. Leaving a username and password on the internet can't possibly end well. – Becuzz Jan 13 '15 at 17:44
  • removed the comment... thank you – Supermac Jan 14 '15 at 07:31

0 Answers0