Solved

Autocomplete Extender Problem

Posted on 2009-07-07
2
695 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adding items to a C# list incrementally 5 82
Running powershell scripts from ASP.NET 6 83
Validation for Passport expiry in asp.net 2 32
Access-Control-Allow-Origin 4 45
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

739 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