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
Solved

Autocomplete Extender Problem

Posted on 2009-07-07
2
687 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…

860 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