<WebMethod()> _
Public Function GetReportToNames(ByVal prefixText As String, ByVal contextKey As String) As String()To
<WebMethod()> _
<Script.Services.ScriptMethod()> _
Public Shared Function GetReportToNames(ByVal prefixText As String, ByVal contextKey As String) As String()
Tim
The above does not help .
I have now posted the out put displayed when the the webservice is executed first with a string array and then with Long numbers
Kindly observe that in case of strings "Null" is appended at the end and in case of numbers
0 is appended at the end
(STRINGS)
<WebMethod()> _
Public Function GetNames() As String()
Dim arr(4) As String
arr(0) = "1"
arr(1) = "2"
arr(2) = "2"
arr(3) = "3"
Return arr
End Function
sara_23apr
Member
70 Points
112 Posts
Re: AutoCompleteExtender displays a 'null' at the end of the list
Jul 09, 2008 04:41 AM|LINK
Tim I really appreciate your reply.
The query runs fine when called directly from the DB. It also runs fine when the Webservice is executed dirtectly.
The null is not present in both the above cases.
I am working on the suggestions u have given . Will get back
Thanks for your time.
Sara
sara_23apr
Member
70 Points
112 Posts
Re: AutoCompleteExtender displays a 'null' at the end of the list
Jul 10, 2008 06:01 AM|LINK
The above does not help .
I have now posted the out put displayed when the the webservice is executed first with a string array and then with Long numbers
Kindly observe that in case of strings "Null" is appended at the end and in case of numbers 0 is appended at the end
(STRINGS)
<WebMethod()> _
Public Function GetNames() As String()
Dim arr(4) As String
arr(0) = "1"
arr(1) = "2"
arr(2) = "2"
arr(3) = "3"
Return arr
End Function
RESULT:
<?xml version="1.0" encoding="utf-8" ?>
- <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<string>1</string>
<string>2</string>
<string>2</string>
<string>3</string>
<string xsi:nil="true" />
</ArrayOfString>
(LONG)
<WebMethod()> _
Public Function GetNames() As Long()
Dim arr(4) As Long
arr(0) = 1
arr(1) = 2
arr(2) = 3
arr(3) = 4
Return arr
End Function
Result
<?xml version="1.0" encoding="utf-8" ?>
- <ArrayOfLong xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<long>1</long>
<long>2</long>
<long>2</long>
<long>3</long>
<long>0</long>
</ArrayOfLong>
Any Help is aprreciated
Thanks
Sara
sara_23apr
Member
70 Points
112 Posts
Re: AutoCompleteExtender displays a 'null' at the end of the list
Jul 10, 2008 06:04 AM|LINK
TCavins
Member
718 Points
213 Posts
Re: AutoCompleteExtender displays a 'null' at the end of the list
Jul 10, 2008 12:32 PM|LINK
This may be the issue.
In your webservice you are defining your items array as
Dim items(dt.Rows.Count) As String
Arrays are zero based and you should set it as dt.Rows.Count - 1
I believe this is the reason you are always getting a null at the end.
Alternatively you could have your webmethod like the following which is how I usually do it. You don't have to size the array ahead of time.
<WebMethod()> _
Public Function MyLookup(ByVal prefixText As String) As String()Dim
items As New List(Of String)For Each...
items.Add(AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(text, value))
Next
Return items.ToArray()
End Function
Hope this helps.
Tim
sara_23apr
Member
70 Points
112 Posts
Re: AutoCompleteExtender displays a 'null' at the end of the list
Jul 25, 2008 12:49 AM|LINK
Tim Thanks For the reply
I shall try the solutions and get back
Sara
sara_23apr
Member
70 Points
112 Posts
Re: AutoCompleteExtender displays a 'null' at the end of the list
Jul 25, 2008 06:31 AM|LINK
Its working!!!! :-)
Tim Thanks a lot
Thanks for your time and the effort in helping me to find a solution.
regards
Sara