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

ASP.NET (VB.NET) Autocomplete AJAX problems.

$
0
0

I am trying to implement an Autocomplete but having problems. Please help.

i have added the toolkit. I have added these controls

<asp:ToolkitScriptManager runat="server" ID="SM" /><asp:AutoCompleteExtender runat="server" ID="autoComplete" ServiceMethod="GetCompletionList" TargetControlID="TextBox1" CompletionInterval="1000" CompletionSetCount="2" MinimumPrefixLength="1" /><asp:TextBox runat="server" ID="TextBox1" />

Firsty, if I click on the control in DESIGN view and click on Add Autocomplete page method. I get an error

Unexpected Error (TargetInvocationException):Exception has been thrown by the target of the invocation......

It however lets me carry on and created the following code

Public Function GetCompletionList() As System.String[]

End Function

So i replace this code with

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

I then run the website, but when I star typing Star Wars in the txt box, nothing happens. I put a debug break at the Dim in the above code but the debugger does not stop thus meaning that this code is not even being run. I thought that if I could at least get it run this code then I could have a good go at debugging myself but the fact that it does not even hit this code means that is a problem way before this.

Anyone shed any light on this to what the problem may be.....

Thanks in advance.


Viewing all articles
Browse latest Browse all 5678

Trending Articles



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