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

Ajax Autocomplete not working

$
0
0

Hi,

I am using the code below to try and get the ajax autocomplete to work but nothing happens when I start typing? When I start typing "sta" it doesnt show me suggestions?

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

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
<System.Web.Script.Services.ScriptService()> _<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _<ToolboxItem(False)> _
Public Class AutoComplete
    Inherits System.Web.Services.WebService<WebMethod()> _
    Public Shared Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer, ByVal contextKey As String) As String()
        ' Create array of movies
        Dim movies() As String = {"Star Wars", "Star Trek", "Superman", "Memento", "Shrek", "Shrek II"}

        ' Return matching movies
        Return (
            From m In movies
    Where (m.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase))
           Select m).Take(count).ToArray()
    End Function


End Class
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %><%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title>Untitled Page</title></head><body><form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server" ><services><asp:ServiceReference Path="~/AutoComplete.asmx" /></services></asp:ScriptManager><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" 
        TargetControlID="TextBox1" ServicePath="~/AutoComplete.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="3" CompletionSetCount="12" EnableCaching="true"></asp:AutoCompleteExtender></form>   </body></html>




Viewing all articles
Browse latest Browse all 5678

Trending Articles



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