Hello ,
I have aproblem with autocomplete extender in Vb website , it does not work at all never call the webservice
here is the code for the page
<asp:TextBox id="TxtITEM_NO" runat="server" CssClass="dbn_tb" Width="225px" autocomplete="off"></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender ID="AUTOCOMP" runat="server" ServicePath ="MESCService.asmx" ServiceMethod ="GetItemCompletionList"
MinimumPrefixLength="2" CompletionInterval="1000" EnableCaching="true" TargetControlID="TxtITEM_NO" CompletionSetCount="12" />
and this is the code inside MESCService.asmx
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Collections.Generic<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class MESCService
Inherits System.Web.Services.WebService<WebMethod()> _
Public Shared Function GetItemCompletionList(ByVal prefixText As String, ByVal count As Integer) As String()
If count = 0 Then count = 20
Dim x As New ikrima.DAL.DBAccess
Dim ds As New System.Data.DataSet
ds = x.ExecuteDataSet("select ITEM_ID FROM ITEM_MASTER ")
Dim items As List(Of String) = New List(Of String)Dim words As Data.DataRow() = ds.Tables(0).Select("ITEM_ID LIKE '" + prefixText + "%'")
Dim num, i As Integer
num = IIf(words.Length < count, words.Length, count)
For i = 0 To num - 1
items.Add(words(i).Item("ITEM_ID").ToString)
Next
Return items.ToArray
End FunctionEnd Class
can any one help me , why this is not work ,
hi ikrima,
Add the following attribute above your webservice class
[ScriptService]
Regards,
Replace this"<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _"line of yours with -----> <ScriptService()> _
Thanks for our replies
i replace my code and change it to <scriptservice()>_ but till now it does not work , and when try to trace my code i found that the autocompleteExtender does not call the webservice , when ever all other ajaxtoolkit is running well
so what is your suggession to solve this ?
HI Ikrima,
Why do you set the propertyautocomplete="off"> ??
Regards,
HI ,
if you rfer to the samplewebsite which is download with AjaxcontrolToolkit source , you will find in the Autocomplete sample they use it ,
actually i try to remove it also but nothing happend
Thanks
Move your MESCService.asmx to your ScriptManager
e.g.
<asp:ScriptManager runat="server" ID="ScriptManager1" EnablePartialRendering="true">
<services>
<asp:servicereference path="~/MESCService.asmx" />
</services>
</asp:ScriptManager>
Hope it works. For it works. For me it does.
, still not working................
Even there is no query on server or any response/request from the page it just ignore it
, still not working................
Even there is no query on server or any response/request from the page it just ignore it
hi i have the same problem in c#,so if u find any solution,please post it here
thanx
replace "<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _" with "<System.Web.Script.Services.ScriptService()> _"
Have you found a solution to your problem?
I found the solution, it seems that the Function name DOES matter. Here is my webservice code returning a generic string array:
Imports
SystemImports
System.WebImports
System.CollectionsImports
System.Web.ServicesImports
System.Web.Script.ServicesImports
System.Web.Services.ProtocolsImports
System.Data.SqlClient<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:=
"http://tempuri.org/")> _<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<
Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _Public
Class WebServiceInherits System.Web.Services.WebService<WebMethod()> _
<ScriptMethod()> _
PublicFunction GetCompletionList(ByVal prefixTextAsString,ByVal countAsInteger)AsString()Dim strArray(2)AsStringstrArray(0) =
"abc"strArray(1) =
"def"strArray(2) =
"ghi"Return strArrayEndFunctionEnd
Class
No comments:
Post a Comment