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.....
the signature of your GetCompletionList is incorrect, it only supports a string and int, but you have string int string, so remove the contextKey param. Not sure if that page is out of date or you're using a different version.
autocompleteajaxASP.NETAjaxAutocomplete
I'm afraid I no longer use this forum due to the new point allocation system.
None
0 Points
5 Posts
ASP.NET (VB.NET) Autocomplete AJAX problems.
Apr 12, 2014 07:05 AM|clifford.papworth|LINK
I am trying to implement an Autocomplete but having problems. Please help.
i have added the toolkit. I have added these controls
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
So i replace this code with
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.
autocomplete ajax ASP.NETAjaxAutocomplete
Star
7722 Points
2560 Posts
Re: ASP.NET (VB.NET) Autocomplete AJAX problems.
Apr 12, 2014 11:17 AM|codeasp|LINK
Where are you specifying the ServicePath in the AutoCompleteExtender? Is the GetCompletionList inside a webservice and is decorated as a web method? Documentation of Autocomplete http://www.asp.net/ajaxlibrary/ajaxcontroltoolkitsamplesite/autocomplete/autocomplete.aspx
autocomplete ajax ASP.NETAjaxAutocomplete
All-Star
37441 Points
9076 Posts
Re: ASP.NET (VB.NET) Autocomplete AJAX problems.
Apr 12, 2014 11:42 AM|AidyF|LINK
According to this
http://www.asp.net/ajaxlibrary/ajaxcontroltoolkitsamplesite/autocomplete/autocomplete.aspx
the signature of your GetCompletionList is incorrect, it only supports a string and int, but you have string int string, so remove the contextKey param. Not sure if that page is out of date or you're using a different version.
autocomplete ajax ASP.NETAjaxAutocomplete