Solved

Autocomplete Extender Problem

Posted on 2009-07-07
2
675 Views
Last Modified: 2012-08-14
I am having a problem getting an autocomplete extender to work in asp.net.  Below is the code that I am attempting as a test to get it working.  Currently, nothing happens when text is entered into the text box.:

=================
Autocomplete.asmx:
=================
<%@ WebService Language="VB" Class="Names" %>

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<WebService(Namespace := "http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _  
Public Class Names
    Inherits System.Web.Services.WebService
   
    <WebMethod()> _
    Public Function Names(ByVal prefixText As String, ByVal count As Integer) As String()
        Dim list As New List(Of String)
        For i = 1 To 5
            list.Add(prefixText & " - " & i)
        Next
        Return list.ToArray
    End Function
End Class

=================
Search.aspx:
=================
...
Test: <asp:TextBox ID="TEST" runat="server" />

 <cc1:AutoCompleteExtender runat="server" ID="autoComplete1" TargetControlID="TEST" ServiceMethod="Names" ServicePath="Autocomplete.asmx" MinimumPrefixLength="2" CompletionInterval="1000" EnableCaching="true" CompletionSetCount="20" DelimiterCharacters=";, :" ShowOnlyCurrentWordInCompletionListItem="true"></cc1:AutoCompleteExtender>
...

Thanks in advance for any assistance you can offer!
0
Comment
Question by:jayh99
2 Comments
 
LVL 1

Accepted Solution

by:
jayh99 earned 0 total points
ID: 24798245
I found the issue, in the Autocomplete.asmx, i needed to include the following line to allow it to be called from a script:

<System.Web.Script.Services.ScriptService()> _

Autocomplete.asmx:
 

<%@ WebService Language="VB" Class="Names" %>
 

Imports System.Web

Imports System.Web.Services

Imports System.Web.Services.Protocols
 

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.

' <System.Web.Script.Services.ScriptService()> _

<WebService(Namespace:="http://tempuri.org/")> _

<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

<System.Web.Script.Services.ScriptService()> _

Public Class Names

    Inherits System.Web.Services.WebService

    

    <WebMethod()> _

    Public Function Names(ByVal prefixText As String, ByVal count As Integer) As String()

        Dim list As New List(Of String)

        For i = 1 To 5

            list.Add(prefixText & " - " & i)

        Next

        Return list.ToArray

    End Function

End Class

Open in new window

0
 
LVL 20

Expert Comment

by:ddayx10
ID: 24798334
LOL I was just getting ready to post on this. You didn't need to add it, you just needed to uncomment it about 4 lines up from where you added it.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now