Note that there are some explanatory texts on larger screens.

plurals
  1. POAutocomplete in WebService using LINQ
    primarykey
    data
    text
    <p>I am using Autocomplete using web service. And in my web service I am using LDS.</p> <p>The problem is that when I am trying this code:</p> <p>This is my UI code which is calling the webservice in Default.aspx:</p> <pre><code>&lt;asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"&gt; &lt;Services&gt; &lt;asp:ServiceReference Path ="WebService1.asmx" /&gt; &lt;/Services&gt; &lt;/asp:ToolkitScriptManager&gt; &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" DelimiterCharacters="" Enabled="True" ServicePath ="WebService1.asmx" ServiceMethod="ReturnEntity" EnableCaching="true" TargetControlID="TextBox1" CompletionSetCount ="1"&gt; &lt;/asp:AutoCompleteExtender&gt; </code></pre> <p>This is my WebService file (webservice1.asmx)</p> <pre><code> [WebMethod] public string[] ReturnEntity(string prefixText, int count) { List&lt;string&gt; responses = new List&lt;string&gt;(); for (int i = 0; i &lt; count; i++) responses.Add(prefixText + (char)(i + 65)); return responses.ToArray(); } </code></pre> <p>Then is it working. However, I am working on this code and it is NOT working...</p> <pre><code> [WebMethod] public string[] ReturnEntity(string prefixText) { using (DataClasses1DataContext search = new DataClasses1DataContext()) { string[] fullText = (from n in search.Entities where n.Name.StartsWith(prefixText) select n.Name).ToArray(); return fullText; } } </code></pre> <p>When I am trying to run the webservice in the browser itself and passing some parameters then it is showing me these:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8" ?&gt; - &lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/"&gt; &lt;string&gt;Starr&lt;/string&gt; &lt;string&gt;Sally Jeans&lt;/string&gt; &lt;string&gt;Steven Kline&lt;/string&gt; &lt;string&gt;Steven Goldberg&lt;/string&gt; &lt;/ArrayOfString&gt; </code></pre> <p>This is not returning any results. I just want to show listings from my table which is Entities, and the column name is 'Name'.</p> <p>Cannot figure it out :(</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload