asp.net - Unable to call webmethod in autocomplete textbox -
aspx page code:
<ajax:scriptmanager id="scriptmanager1" runat="server"> <services > <ajax:servicereference path="myservice.asmx" /> </services> </ajax:scriptmanager> <asp:textbox id="txtmaterialno" width="100%" runat="server" ></asp:textbox> <cc1:autocompleteextender id="autocompleteextender1" runat="server" completioninterval="20" minimumprefixlength="1" servicemethod="getmaterialid" servicepath="myservice.asmx" targetcontrolid="txtmaterialno"> </cc1:autocompleteextender> myservice.asmx
[scriptservice] [webservice(namespace = "http://tempuri.org/")] [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)] public class myservice : system.web.services.webservice public myservice() { //uncomment following line if using designed components //initializecomponent(); } [system.web.services.webmethod] public string[] getmaterialid(string prefixmaterial) { ...... code .... return } } but when typing textbox no suggestion coming, when placing breakpoint @ getmaterialid can see not coming function calling myservice on textchange.
how fix this? why calling constructor not webmethod?
you need add scriptmethodattribute so:
[webmethod] [scriptmethod] public string[] getmaterialid(string prefixmaterial) { ...... code .... return }
Comments
Post a Comment