Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Can't get AutoCompleteExtender to work

$
0
0

Not sure what I'm doing wrong, but typing in the textbox produces nothing. Code below

<asp:TextBox ID="NewRoamerTB" runat="server" AutoPostBack="True"></asp:TextBox><ajaxToolkit:AutoCompleteExtender ID="NewRoamerTBACE" runat="server" TargetControlID="NewRoamerTB" ServiceMethod="GetStates" MinimumPrefixLength="1" DelimiterCharacters="" Enabled="True" CompletionInterval="200" EnableCaching="False" ServicePath="~/AutoComplete.asmx"></ajaxToolkit:AutoCompleteExtender>
AutoCompleteasmx.vb

Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.Services

Namespace AutoCompleteExample
    ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
    <WebService([Namespace]:="http://tempuri.org/")><WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)><System.ComponentModel.ToolboxItem(False)><System.Web.Script.Services.ScriptService>
    Public Class AutoComplete
        Inherits System.Web.Services.WebService<WebMethod>
        Public Function GetStates(prefixText As String, count As Integer, contextKey As String) As List(Of String)
            Dim states As New List(Of String)() From {"Alaska","Alabama","California","North Dakota"
            }

            Return states
        End Function
    End Class
End Namespace

AutoComplete.asmx

<%@ WebService Language="vb" CodeBehind="AutoComplete.asmx.vb" Class="AutoCompleteExample.AutoComplete" %>

web.config

<remove verb="*" path="*.asmx"/><add verb="*" path="*.asmx" type="System.Web.Script.Services.ScriptHandlerFactory" validate="false"/>

MasterPage.master

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True"><Services><asp:ServiceReference
       path="~/AutoComplete.asmx" /></Services></asp:ScriptManager>


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>