I have created a web service in .net which will retrieve the city name based on the given input text. The web service is working properly. I have used that web service in an AutoCompleteExtender Control in ajax control toolkit. But i am not getting the list of suggestions if i type anything in the textbox.
The web service structure is:
public string GetCompletionList(string prefixText)
<body>
<form id="form1" runat="server">
<div>
<!--.........................................
.........................................
.........................................-->
<asp:TextBox ID="txtsearchcity" runat="server" class="autosuggest"></asp:TextBox>
<asp:AutoCompleteExtender runat="server"
ID="autoComplete1"
TargetControlID="txtsearchcity"
ServicePath="http://localhost:3935/SearchCity/searchcity.asmx"
ServiceMethod="GetCompletionList"
MinimumPrefixLength="2"
CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="20">
</asp:AutoCompleteExtender>
<!--.........................................
.........................................
.........................................-->
</div>
</form>
</body>
What should be the exact ServicePath and ServiceMethod?
Whether the css file is necessary to get the output?
Take a look at the official documentation, here. It denotes that the signature of the service method MUST match the following:
So, I would start by adding a method with this signature to your existing web service.
Also, I would suggest that you leverage some of the browser-based tooling (script debugging, http debugging, etc.) to ensure:
If you’re not quite sure where to start, take a look at Chrome’s Developer Tools, particularly, the Network Panel.
As far as your current configuration is concerned (ServicePath, ServiceMethod, etc.), everything looks in place to me.