asp.net ajax - AjaxAutoComplete not working after migration to C# -
my autocomplete works fine when using old site not work when ported on c# , entity framework. below html part of user control. i've put breakpoints in webservice code , doesn't it's getting called. don't know else check see break is. appreciated. thanks.
<asp:scriptmanagerproxy id="scriptmanagerproxy1" runat="server"> </asp:scriptmanagerproxy> <asp:textbox id="textboxdamname" runat="server" columns="50"></asp:textbox> <asp:autocompleteextender id="textboxdamname_autocompleteextender" runat="server" delimitercharacters="" enabled="true" servicepath="damsafetyautocomplete.asmx" servicemethod="selectdamnames" firstrowselected="true" minimumprefixlength="1" completioninterval="200" targetcontrolid="textboxdamname"> </asp:autocompleteextender></td> namespace externaldamsafetysearch { /// <summary> /// summary description damsafetyautocomplete /// </summary> [webservice(namespace = "http://tempuri.org/")] [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)] [system.componentmodel.toolboxitem(false)] // allow web service called script, using asp.net ajax, uncomment following line. [system.web.script.services.scriptservice] public class damsafetyautocomplete : system.web.services.webservice { [webmethod] [system.web.script.services.scriptmethod] public string[] selectdamnames(string prefixtext, int32 count) { try { enterprisepubentities ee = new enterprisepubentities(); return ee.damsafetydatas .take(count) .where(c => c.damname.startswith(prefixtext)) .distinct() .orderby(c => c.damname) .select(c => c.damname) .toarray(); } catch (exception) { throw; } } } }
turns out wasn't directing control correct locatioin webservice file. once fixed still wasn't getting results though hitting method in webservice. turns out wasn't return results correctly. fixed turning this
return ee.damsafetydatas .take(count) .where(c => c.damname.startswith(prefixtext)) .distinct() .orderby(c => c.damname) .select(c => c.damname) .toarray();
to
return ee.damsafetydatas .where(c => c.damname.startswith(prefixtext)) .distinct().take(count) .orderby(c => c.damname) .select(c => c.damname) .tolist.toarray();
i had change location of .take(count) because take first (count = 10) list filter them starts with.
Comments
Post a Comment